Answer the question
In order to leave comments, you need to log in
Should I bother with roles?
Hello. Such a question: there is a simple project with the possibility of adding articles and comments by users, as well as evaluating articles added by other users. You can check user actions like this:
1. Adding an article: if (\Auth::user())
2. Editing an article: if ($user->isAdmin() || ($user->id == $author))
3. Evaluating an article: if (\Auth::user() && ($user->id != $author))
Is it worth bothering with plugins for installing roles in this case? I have never worked with them, so I'm interested in the following question: in which projects should they be used, and in which not?
Answer the question
In order to leave comments, you need to log in
You have enough native Gate
. Authorization section in the documentation. Roles are not particularly needed here, the description of the three permissions in AuthServiceProvider
.
Install Entrust, the most conveniently customizable and flexible.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question