Answer the question
In order to leave comments, you need to log in
How to implement project architecture with 3 user roles in laravel?
There are roles: user, administrator, site owner.
How to implement the logic correctly, breaking it down by roles and each user will be entered into the users table where there will be a role field or create 3 different models for each type of user (3 tables in the database, respectively).
User: can add/modify his posts.
Administrator: message moderation.
Site owner: higher level of rights (adding, deleting messages).
Answer the question
In order to leave comments, you need to log in
https://www.google.ru/search?q=laravel+rbac
or
https://laravel.com/docs/5.4/authorization#gates
If you have only three roles, and they intersect in functionality (it is enough for the user to be in one of them to make it clear what he can do) - of course role in User.
If there are many roles and each gives a small set of permissions, and the total permission field is collected from their summation, then, of course, there must be a User connection with several Roles. Or, if you want to go deeper into hell^W^W^W, assign multiple Permissions to each Role to control exactly what each role can do and change while the site is running.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question