I am trying to check if a user has permission for a specific model. So far (with Laravel 5.2) I have added this code to the constructor:
public function __construct() { if (!Auth::user()->hasPermission('usergroups')) { abort(404); } }
Now, after upgrading to Laravel 5.3, Auth::user() returns null when called from the controller constructor. If I call it in any other class method, it returns the current user.
Any ideas why?
source share