Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
|
||
use Illuminate\Config\Repository; | ||
use Symfony\Component\Finder\Finder; | ||
use Symfony\Component\Finder\SplFileInfo; | ||
use Illuminate\Contracts\Foundation\Application; | ||
use Illuminate\Contracts\Config\Repository as RepositoryContract; | ||
|
||
|
@@ -69,10 +70,26 @@ protected function getConfigurationFiles(Application $app) | |
|
||
foreach (Finder::create()->files()->name('*.php')->in($app->configPath()) as $file) | ||
{ | ||
$files[basename($file->getRealPath(), '.php')] = $file->getRealPath(); | ||
$files[$this->getConfigurationSubtree($file).basename($file->getRealPath(), '.php')] = $file->getRealPath(); | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
antonioribeiro
Author
Contributor
|
||
} | ||
|
||
return $files; | ||
} | ||
|
||
/** | ||
* Get the configuration file subtree. | ||
* | ||
* @param \Symfony\Component\Finder\SplFileInfo $file | ||
* @return string | ||
*/ | ||
private function getConfigurationSubtree(SplFileInfo $file) | ||
{ | ||
if ($tree = ltrim(dirname($file->getRealPath()), config_path())) | ||
{ | ||
$tree = str_replace(DIRECTORY_SEPARATOR, '.', $tree) . '.'; | ||
} | ||
|
||
return $tree; | ||
} | ||
|
||
} |
This breaks current configurations.
For example, I had a config file in the "packages" directory.
I was using
Config::get('my_cfg_file.key')
which is suddenly broken, because it now needs to be:Config::get('packages.my_cfg_file.key')