Answer the question
In order to leave comments, you need to log in
How to write a Trait for the UserController.php controller that will return information about the employee by his id?
I created a database with tables users and users_roles, but I can’t figure out how to proceed, the very structure of actions
Answer the question
In order to leave comments, you need to log in
And here Trait? You need to describe the relationships in the model. Call in controllerUser::with('roles')->find(1);
Information about the employee by id is returned via
Roles need a manytomany
relationship There
are few roles, specific permissions are needed. For example, viewing a specific section. This action can be the same for different roles. Therefore, you need to make perms and associate with roles through many to many. Checking via gate/can .
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question