phpvms/app/Bootstrap/LoadConfiguration.php

38 lines
1.2 KiB
PHP
Raw Normal View History

<?php
namespace App\Bootstrap;
use Illuminate\Contracts\Config\Repository as RepositoryContract;
2018-02-21 12:33:09 +08:00
use Illuminate\Contracts\Foundation\Application;
/**
* Class LoadConfiguration
*/
class LoadConfiguration extends \Illuminate\Foundation\Bootstrap\LoadConfiguration
{
/**
* Load the configuration items from all of the files.
*
2018-08-27 00:40:04 +08:00
* @param \Illuminate\Contracts\Foundation\Application $app
* @param \Illuminate\Contracts\Config\Repository $repository
*
* @throws \Exception
*/
protected function loadConfigurationFiles(Application $app, RepositoryContract $repository)
{
parent::loadConfigurationFiles($app, $repository);
2018-08-27 00:40:04 +08:00
/*
* Read in the base config, only if it exists
*/
if (file_exists($app->basePath().'/config.php')) {
$local_conf = include $app->basePath().'/config.php';
foreach ($local_conf as $namespace => $override_config) {
$config = $repository->get($namespace, []);
$update_config = array_replace_recursive($config, $override_config);
$repository->set($namespace, $update_config);
}
}
}
}