Open shahidkarimi opened 7 years ago
You search for the specific role in roles relation of the user like '$role = $user->roles()->where("name", "admin-role-name)->first()'
Then you just call '$user->roles()->detatch($role)'
Thats basicly it. Have in mind you add a many-to-many relation between user and roles. For further explanations i would refer to the laravel docs > eloquent > updating many to many relations.
Regards Dominik
$roles = ['admin','su']; $user->detachRoles($roles);
There is no method to remove a role from a user. How to do that?