diff --git a/src/Illuminate/Foundation/Bootstrap/DetectEnvironment.php b/src/Illuminate/Foundation/Bootstrap/DetectEnvironment.php index 03914738d960..7ea3d6784030 100644 --- a/src/Illuminate/Foundation/Bootstrap/DetectEnvironment.php +++ b/src/Illuminate/Foundation/Bootstrap/DetectEnvironment.php @@ -16,14 +16,16 @@ class DetectEnvironment */ public function bootstrap(Application $app) { - if (! $app->configurationIsCached()) { - $this->checkForSpecificEnvironmentFile($app); + $app->detectEnvironment(function () use ($config) { + return env('APP_ENV', 'production'); + }); - try { - (new Dotenv($app->environmentPath(), $app->environmentFile()))->load(); - } catch (InvalidPathException $e) { - // - } + $this->checkForSpecificEnvironmentFile($app); + + try { + (new Dotenv($app->environmentPath(), $app->environmentFile()))->load(); + } catch (InvalidPathException $e) { + // } } @@ -35,11 +37,7 @@ public function bootstrap(Application $app) */ protected function checkForSpecificEnvironmentFile($app) { - if (! env('APP_ENV')) { - return; - } - - $file = $app->environmentFile().'.'.env('APP_ENV'); + $file = $app->environmentFile().'.'.$app->environment(); if (file_exists($app->environmentPath().'/'.$file)) { $app->loadEnvironmentFrom($file); diff --git a/src/Illuminate/Foundation/Bootstrap/LoadConfiguration.php b/src/Illuminate/Foundation/Bootstrap/LoadConfiguration.php index eb4d07691470..9f1c7316341e 100644 --- a/src/Illuminate/Foundation/Bootstrap/LoadConfiguration.php +++ b/src/Illuminate/Foundation/Bootstrap/LoadConfiguration.php @@ -38,10 +38,6 @@ public function bootstrap(Application $app) $this->loadConfigurationFiles($app, $config); } - $app->detectEnvironment(function () use ($config) { - return $config->get('app.env', 'production'); - }); - date_default_timezone_set($config['app.timezone']); mb_internal_encoding('UTF-8');