Easiest way: Auth::user() && Auth::user()->hasPermission(x)
.
Longer way to make it work with only "Auth::user()
- you can overload the Auth class to return a GuestUser
if there is no current user to act as the NullObject pattern.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community