P
P
photosho2016-01-13 19:00:27
Laravel
photosho, 2016-01-13 19:00:27

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

2 answer(s)
G
Gregory, 2016-01-13
@photosho

You have enough native Gate. Authorization section in the documentation. Roles are not particularly needed here, the description of the three permissions in AuthServiceProvider.

A
Andrzej Wielski, 2016-01-16
@wielski

Install Entrust, the most conveniently customizable and flexible.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question