A
A
Alexander Sharomet2019-12-27 22:42:13
Laravel
Alexander Sharomet, 2019-12-27 22:42:13

Why do we need gates in laravel if there is a middleware?

Hello.
I can not understand in any way what is the point of using gates in laravel. Read that gates use for check of roles and authorization.
Isn't it more convenient to use middleware ?
You create a middleware, add a group with this middleware to the router, upload pages there that need verification for authorization and roles.
What did I miss?
Thank you.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
J
JhaoDa, 2019-12-27
@JhaoDa

Because authentication and authorization are different things.
Because gates and middleware are completely unrelated things.
I recommend reading the documentation not diagonally, but sequentially.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question