mirror of
https://github.com/laravel/laravel.git
synced 2025-02-20 11:53:14 +08:00
Simplify environment loading.
This commit is contained in:
parent
6980d95c21
commit
5a34c60c61
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,6 +1,6 @@
|
||||
.env.*
|
||||
/.idea
|
||||
/vendor
|
||||
.env
|
||||
.DS_Store
|
||||
Thumbs.db
|
||||
composer.lock
|
||||
|
@ -1,5 +1,27 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Load Environment Variables
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Next we will load the environment variables for the application which
|
||||
| are stored in the ".env" file. These variables will be loaded into
|
||||
| the $_ENV and "putenv" facilities of PHP so they stay available.
|
||||
|
|
||||
*/
|
||||
|
||||
try
|
||||
{
|
||||
Dotenv::load(__DIR__.'/../');
|
||||
|
||||
Dotenv::required('APP_ENV');
|
||||
}
|
||||
catch (RuntimeException $e)
|
||||
{
|
||||
die('Application environment not configured.'.PHP_EOL);
|
||||
}
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Detect The Application Environment
|
||||
@ -11,8 +33,7 @@
|
||||
|
|
||||
*/
|
||||
|
||||
$env = $app->detectEnvironment([
|
||||
|
||||
'local' => ['homestead'],
|
||||
|
||||
]);
|
||||
$env = $app->detectEnvironment(function()
|
||||
{
|
||||
return getenv('APP_ENV');
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user