laravel-roles-permissions
laravel-roles-permissions copied to clipboard
Issue with hasRole & can
I have two errors in the RoleMiddelware. Both the hasRole and the can methods are marked as undefined.
public function handle($request, Closure $next, $role, $permission = null) { if(!auth()->user()->hasRole($role)) { abort(404); } if($permission !== null && !auth()->user()->can($permission)) { abort(404); } return $next($request); }
it will happen if you are not authorized.