According to this post , in order to replace the original public path, we need to redefine the application paths:
<?php namespace App; use Illuminate\Foundation\Application; class MyApp extends Application { protected $appPaths = array(); public function __construct($appPaths = null) { $this->registerBaseBindings(); $this->registerBaseServiceProviders(); $this->registerCoreContainerAliases(); if (!is_array($appPaths)) { abort(500, '_construct requires paths array'); } if (!isset($appPaths['base'])) { abort(500, '_construct requires base path'); } $this->appPaths = $appPaths; $this->setBasePath($appPaths['base']); } public function setBasePath($basePath) { $this->basePath = $basePath; $this->bindPathsInContainer(); return $this; } protected function bindPathsInContainer() { $this->instance('path', $this->path()); foreach (['base', 'config', 'database', 'lang', 'public', 'storage'] as $path) { $this->instance('path.'.$path, $this->{$path.'Path'}()); } } public function path() { return $this->basePath.'/app'; } public function basePath() { return $this->basePath; } public function configPath() { if (isset($this->appPaths['config'])) { return $this->appPaths['config']; } return $this->basePath.'/config'; } public function databasePath() { if (isset($this->appPaths['database'])) { return $this->appPaths['database']; } return $this->basePath.'/database'; } public function langPath() { if (isset($this->appPaths['lang'])) { return $this->appPaths['lang']; } return $this->basePath.'/resources/lang'; } public function publicPath() { if (isset($this->appPaths['public'])) { return $this->appPaths['public']; } return $this->basePath.'/public'; } public function storagePath() { if (isset($this->appPaths['storage'])) { return $this->appPaths['storage']; } return $this->basePath.'/storage'; } }
This seems strange to me, and as mentioned in the post, it looks like we have taken a step back in Laravel functionality, I hope that they will change it in a future update.
source share