Answer the question
In order to leave comments, you need to log in
Implementation of groups, roles and user rights in laravel, is there such a solution?
Good afternoon!
Please tell me, I googled, I did not find anything like this ready.
It is necessary that the user has a group, then he can follow a specific route.
(The route skips only 1 group, in turn the user can have membership in several groups)
Next, it is necessary that the user has a role by which it will be determined what will be displayed on the page. Even this will be enough.
Sample scheme
User - id, name, password
1, Petya, qwe
2, Vasya, ewq
3, Kolya, qaz
Group - user_id, group_id, group_name (for clarity)
1, 1, Worker
1, 2, Warmir
2, 3, Security
3, 1, worker
Roles - user_id, role_id, group_id, role_name (for clarity)
1, 1, 1, Admin
2, 2, 1, Moder
3, 3, 2, User
2, 1, 3, Admin
And it turns out that the user Petya can switch to Worker and on
Warmir
, on Worker it will be
Admin , and
on Warmir it
has
no
role -> hasToMany(Role)
REQUIRED LIKE THIS:
User -> hasToMany(Group)
User ->hasToMany(Role)
Group -> hasToMany(Role)
Answer the question
In order to leave comments, you need to log in
So you need a normal ACL with roles, rights and other things. I usually use this package https://github.com/spatie/laravel-permission
The best bouncer - like so.
Why I don’t remember the best, but I decided for myself a year ago.
Here is a nice and simple solution to roles and rights! Helped me
https://laravel.demiart.ru/guide-to-roles-and-perm...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question