mirror of
https://github.com/pelican-dev/panel.git
synced 2025-05-20 12:14:45 +02:00
Make sure to not sync root admin role (#1113)
This commit is contained in:
parent
f2f3ee548f
commit
f563128237
@ -122,6 +122,11 @@ class UserResource extends Resource
|
||||
CheckboxList::make('roles')
|
||||
->disableOptionWhen(fn (string $value): bool => $value == Role::getRootAdmin()->id)
|
||||
->relationship('roles', 'name')
|
||||
->saveRelationshipsUsing(function (User $user, array $state) {
|
||||
$roles = collect($state)->map(fn ($role) => Role::findById($role))->filter(fn ($role) => $role->id !== Role::getRootAdmin()->id);
|
||||
|
||||
$user->syncRoles($roles);
|
||||
})
|
||||
->dehydrated()
|
||||
->label(trans('admin/user.admin_roles'))
|
||||
->columnSpanFull()
|
||||
|
Loading…
x
Reference in New Issue
Block a user