A
A
Andrey Melentiev2015-04-16 09:39:33
Laravel
Andrey Melentiev, 2015-04-16 09:39:33

Roles and permissions in Laravel web application?

Correct me if I'm wrong... I have a certain table of users in the "role" field, respectively, in this field I specify the user's role... Permissions need to be assigned for each role. The question is how to do it right. The most banal method is to add 3 more tables from the series "role", "premission", "user_role", and dance from it. Or all the same, paint all the permissions in a separate controller that will determine by the user.role field what can and cannot be done by a user with a particular role. What is the best and most convenient way?
Ask questions if you don’t understand, I’m not very talented at writing text ....

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
Ivan Zhuk, 2015-04-16
@Sinersis

It is more convenient to use a ready-made solution, for example: https://github.com/Zizaco/entrust . But if you want to make your own "bicycle", then the best solution would be what you described with the tables. Look at how entrust works , it works exactly according to this principle.

F
FernandoErrNando, 2015-04-16
@FernandoErrNando

You can use Sentry:
https://cartalyst.com/manual/sentry/2.1
A small example on Habré

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question