-
I have been registering several users testing and I have a problem that I do not know if it is only mine that when updating the roles of 1 user, I delete the roles of 1 team, ie. Team A: Team B: I use this method: I attach a graphical example Now I added role in another team to the same user 3 and I deleted the roles and the previous team. Version |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Always show your laravel, package and php versions, no one can guess If you use laravel-permission/src/Traits/HasRoles.php Lines 196 to 201 in 193e50e |
Beta Was this translation helpful? Give feedback.
-
😄 that is your |
Beta Was this translation helpful? Give feedback.
Always show your laravel, package and php versions, no one can guess
Looks like that problem was fixed in the latest version #1888
If you use
$user->syncRoles($request->get('roles'));
and$request->get('roles')
only has one role_id(2), it will detach all roles and put only role_id(2), it's the expected behaivor, read the documentationlaravel-permission/src/Traits/HasRoles.php
Lines 196 to 201 in 193e50e