P
P
Puganov2015-10-30 20:04:02
Laravel
Puganov, 2015-10-30 20:04:02

How to properly design roles in laravel 5?

263517733a76444b9544ea5e33ae9354.PNG
Good day.
There are 3 main roles: Guest, Employee, Administrator
I will not touch on the roles of Administrator and Guest, the whole point is in the role: Employee
Employee has 2 directions:
1. Applications at home (home service)
2. Applications in the workshop
Each of the directions has types ( roles) of employees.
Question:
How to correctly compose the roles of employees? What library to use for this? How to organize all this structure on the laravel framework correctly?
PS Given that the user will have one account. And there can be several types of employees to which it is assigned. Those. one employee could work in different types: as a computer master in the service, and a computer master at home.
It suggests itself from there: an employee who logs into the application will be able to switch his account type.
How to organize the transition between accounts both in the type of work and in the type of the employee's role in this type of work?
PS When switching to another (so to speak) employee account, he must also switch to the corresponding internal controller (if one is used), then how to fix its state? Likely by means of Cookie or Session.
Everything that comes to my mind. So for starters, write your role mode from scratch.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Arman, 2015-10-30
@Arik

What library to use for this?

Currently the most popular:
https://github.com/Zizaco/entrust
The example shows how to set roles. And so you can add a field of the current type to the User model and already assign the appropriate rights

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question