Example, if my .env is
APP_ENV=local
APP_URL=http://localhost:8888/
APP_DEBUG=true
FACEBOOK_APP_ID = ABC
I know in Laravel we can do access our .env file by doing this
echo env('APP_ENV'); --> 'local'
echo env('APP_URL'); --> 'http://localhost:8888/'
but I wonder if there is a way to programmatically set it
Ex. env('APP_ENV') == 'production';
This might help.
try this
taken from here stack answer
You can use:
because
env
is just a convenience wrapper aroundgetenv
which does some type conversion.Note: this is not permanent as it will be overwritten by
.env
when the next request happens.