P
P
Pavel2020-04-28 15:22:42
Laravel
Pavel, 2020-04-28 15:22:42

Redirect to another page if there is no access?

Hello!

I have 2 admin panels in my project, for simplicity of designation, let there be an admin panel for the manager and for the admin . The

task is to determine the user's access level and redirect to the admin panel he needs if he went somewhere wrong.

I understand that you can put a check in each method Auth::user()->role;and followed by a redirect, but somehow I don’t want to shove the same check template into hundreds of methods, I want to set all the logic somewhere in one place and, in which case, correct it a little and not run through hundreds files and look for where I could forget

Tell me how this can be implemented?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
metallix, 2020-04-28
@yatort

middleware . What you need

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question