Answer the question
In order to leave comments, you need to log in
How to organize authorization in Laravel?
Tell me, if you use middleware in routes,
will this step be enough for security or is it worth checking authorization also through an observer?
PS I'm just learning =)
Route::get()->middleware('auth');
Answer the question
In order to leave comments, you need to log in
Yes, everything is fine.
The main thing is that the logic in this middleware is correct and do not forget to hang this middleware on the routes where this authorization is needed.
The logic itself is simple - checking the session key / token or something else. If there is a division into roles / rights, then check for the sufficiency of the role for the action being performed. All.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question