Skip to content

Problem when synchronizing (delete or add roles) the same user to 2 different teams #1921

Answered by erikn69
alexv96 asked this question in Q&A
Discussion options

You must be logged in to vote

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 documentation

public function syncRoles(...$roles)
{
$this->getRolesRelation()->detach();
return $this->assignRole($roles);
}

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by alexv96
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants