laravel-roles-permissions icon indicating copy to clipboard operation
laravel-roles-permissions copied to clipboard

Issue with hasRole & can

Open Ivanhoe1325 opened this issue 4 years ago • 1 comments

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); }

Ivanhoe1325 avatar Dec 09 '20 11:12 Ivanhoe1325

it will happen if you are not authorized.

c-aursu avatar Aug 11 '21 18:08 c-aursu