Use Laravel Gates, in your controller methods. For instance:
public function update(Role $role){ if(\Gates::allows('manageRoles',$role)) { return redirect()->back()->with('status','Success'); }
However, I personally find it too problematic to set a redirect page for each controller action. If the action is rejected because the user was manipulating the URL, and not because some preconditions were not met, then the 404th page with the home button is enough.
As in the answer above, it is much simpler and easier to use the Laravel answers, call up the desired error page and send a custom message.
like this answer from another topic:
return response("User can't perform this action.", 401);
fooobar.com/questions/2348355 / ...
source share