feat: Disable and hide user management actions for the PERUSAHAAN role.

This commit is contained in:
Yoga Pangestu 2026-01-05 08:43:33 +07:00
parent fa6e2ef92d
commit 03bf59e11e

View File

@ -124,7 +124,8 @@ public static function table(Table $table): Table
->where('user_id', $record->id)
->delete();
}
}),
})
->disabled(fn (User $record) => $record->hasRole(RoleEnum::PERUSAHAAN->value)),
TextColumn::make('roles.name')
->label('Peran')
@ -141,13 +142,17 @@ public static function table(Table $table): Table
])
->recordActions([
EditAction::make()
->modalWidth(Width::Large),
->modalWidth(Width::Large)
->hidden(fn (User $record) => $record->hasRole(RoleEnum::PERUSAHAAN->value)),
DeleteAction::make(),
DeleteAction::make()
->hidden(fn (User $record) => $record->hasRole(RoleEnum::PERUSAHAAN->value)),
ForceDeleteAction::make(),
ForceDeleteAction::make()
->hidden(fn (User $record) => $record->hasRole(RoleEnum::PERUSAHAAN->value)),
RestoreAction::make(),
RestoreAction::make()
->hidden(fn (User $record) => $record->hasRole(RoleEnum::PERUSAHAAN->value)),
])
->toolbarActions([
BulkActionGroup::make([