role->permissions->contains(Permission::firstWhere('name','=','pdf_viewAny')) ? Response::allow() : Response::deny('you are not the chosen one'); } /** * Determine whether the user can update the model. * * @return Response */ public function view(): Response { return Auth::user()->role->permissions->contains(Permission::firstWhere('name','=','pdf_view')) ? Response::allow() : Response::deny('you are not the chosen one'); } /** * Determine whether the user can delete the model. * * @return Response */ public function delete(): Response { return Auth::user()->role->permissions->contains(Permission::firstWhere('name','=','pdf_delete')) ? Response::allow() : Response::deny('you are not the chosen one'); } }