forceFill($data); $record->save(); return $record; } protected function getActions(): array { return [ Actions\Action::make('two_factor_authentication') ->label(__('Disable two-factor authentication')) ->color('secondary') ->action(function () { $this->record->disableTwoFactorAuth(); Notification::make() ->body(__('Two-factor authentication disabled')) ->success() ->send(); }) ->visible(fn () => $this->record->hasTwoFactorEnabled()) ->requiresConfirmation(), Actions\Action::make('delete') ->form([ Toggle::make('remove_all_data') ->label(__('Delete all servers, sites, databases, etc.')) ->default(true) ->helperText(__('This will delete all the servers, sites, databases, etc. associated with this user. Servers & sites that belong to multiple users will not be deleted. This action cannot be undone.')), ]) ->requiresConfirmation() ->action(function (array $data) { app(DeleteUserAction::class)->execute($this->getRecord(), $data['remove_all_data']); Notification::make() ->body(__('User deleted')) ->success() ->send(); $this->redirectRoute('filament.resources.users.index'); }) ->color('danger'), ]; } }