Reputation: 3501
So I am trying to add a new environment variable and use it in the layout file so I can hide part of menu if registration is disbled
.env
ALLOW_REGISTRATION=FALSE
layouts/apps/blade.php
@if (env('ALLOW_REGISTRATION',TRUE))
...
Error I am getting
Trying to get property of non-object (View: /home/jj/Development/app/resources/views/layouts/app.blade.php) (View: /home/jj/Development/app/resources/views/layouts/app.blade.php)
Thoughts?
Upvotes: 1
Views: 535
Reputation: 1731
Try php artisan serve
and check again. The function env() does not gets the values from the .env file when called.
Upvotes: 1