i try find out why env() helper returns null. causes trouble in app.php file, env() helpers used default. perhaps mysterious server setting?
my env file:
app_env=production app_key=base64:mymagickey= app_debug=false app_log_level=info app_url=http://www.example.com  etc... edit - tried following:
php artisan cache:clear php artisan view:clear php artisan config:cache and ofcourse, using env helper this: env('app_env')
but still no success. wierd part is, $_env php variable contains every single variable .env file.
use \config::get('app.env'); instead of env(app_env); because you're going same error , that's not live website.
if want add custom variables env, go config app , find this:
/*     |--------------------------------------------------------------------------     | application environment     |--------------------------------------------------------------------------     |     | value determines "environment" application     | running in. may determine how prefer configure various     | services application utilizes. set in ".env" file.     |     */  'env' => env('app_env', 'production'), add new line under "'env' => env('app_env', 'production'),", example, following:
/*     |--------------------------------------------------------------------------     | application environment     |--------------------------------------------------------------------------     |     | value determines "environment" application     | running in. may determine how prefer configure various     | services application utilizes. set in ".env" file.     |     */  'env' => env('app_env', 'production'), 'key' => env('app_key'), you can call "key" variable this:
\config::get('app.key'); whenever add new variable "key" app env, you'll need use config:cache reset cache.
Comments
Post a Comment