Replies: 3 comments 1 reply
-
Read documentation |
Beta Was this translation helpful? Give feedback.
-
Lookup the role record which matches the desired guard, and assign that role record to the user: $role = Role::findByName('role name here', 'guard name here');
$user->assignRole($role); |
Beta Was this translation helpful? Give feedback.
-
you can assign roles with other guards than default guard ( see documentation here in the note section). $role = Role::findByName('my_role', 'my_different_guard');
$user->guard_name = 'my_different_guard';
$user->assignRole($role); but not sure if it's a good idea... |
Beta Was this translation helpful? Give feedback.
-
Hi. If I get it right, assingRole() method allows to assign role only with default guard name. Is the a way to do it for roles with different guard names?
Beta Was this translation helpful? Give feedback.
All reactions