T
T
Timur Valitov2017-06-22 11:33:48
Laravel
Timur Valitov, 2017-06-22 11:33:48

How to restrict access in laravel 5.4?

Good afternoon!
I apologize for the question, which has been repeatedly discussed here and on other resources. I'm new to php, writing procedural code occasionally, just for myself. Recently, I wanted to try frameworks, I tried laravel, looked at a couple of lessons, read the documentation, I liked it. In general, most questions disappear by themselves. Google and documentation help in 9 cases out of 10. However, I have not figured out this issue.
I created a project, created a basic registration and authentication form with artisan make:auth. Everything is just great, I figured out why the password recovery email contains a link like localhost/recovery_code, why the accounts were not created initially (did not migrate). Now everything is fine and the user sees the treasuredYou are logged in! .
Now I'm trying to figure out how, for example, to deny access to this page to ordinary users. It is clear that you need to create separate roles and check which group the user belongs to. Could you explain in words what to do in this case? I think if it comes to me how to disable access to the base page, then I can handle all the rest.
PS
I have read all possible answers on Toaster about this, the official documentation and all other resources. Unfortunately, I understand, for example, video tutorials, when people clearly show certain methods at work.
Thank you!

Answer the question

In order to leave comments, you need to log in

3 answer(s)
D
D3lphi, 2017-06-22
@D3lphi

Laravel Enrust
The documentation explains everything very intelligibly. We read, we use.

K
kstyle, 2017-06-22
@kstyle

laravel gate about middleware, of course, you should read

A
Alex Wells, 2017-06-26
@Alex_Wells

Best solution integrated with laravel gates, very advanced, well written: https://github.com/JosephSilber/bouncer
Definitely the best solution (entrust is not even close). I use it wherever possible.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question