I upgraded laravel 5.1 to 5.2, everything looks good. But when try to access the app environment not getting what expected.
When i dd($_ENV) this is what i get
"APP_ENV" => "vagrant"
"APP_DEBUG" => "true"
"DB_HOST" => "localhost"
But When dd(\App::environment());
"production"
P.S. even I checked in tinker: dd(env('APP_ENV')) gives me "vagrant"
but dd(\App::environment()) gives me "production".
Dont you think it is odd :(
This is wierd :(
Anyone face this problem ??
In Laravel 4 and 5, the Laravel official docs suggest using: $environment = App::environment();
In a fresh Laravel installation, the root directory of your application will contain a .env.example file that defines many common environment variables.
php artisan config:cache This command clears the cached config file as mentioned above and recaches the latest configurations into a single file again.
you missed a step in the upgrade process:
Configuration
Environment Value
Add an env configuration option to your app.php configuration file that looks like the following:
'env' => env('APP_ENV', 'production'),
P.S. You can check the value from the artisan command:
php artisan env
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With