protected function syncGroups(array $groups, UserInterface $user) { $user->groups()->detach(); $user->groups()->sync($groups); }