label(trans('admin/databasehost.rotate')); $this->icon('tabler-refresh'); $this->authorize(fn (Database $database) => auth()->user()->can('update database', $database)); $this->modalHeading(trans('admin/databasehost.rotate_password')); $this->modalIconColor('warning'); $this->modalSubmitAction(fn (StaticAction $action) => $action->color('warning')); $this->requiresConfirmation(); $this->action(function (DatabasePasswordService $service, Database $database, Set $set) { try { $service->handle($database); $database->refresh(); $set('password', $database->password); $set('jdbc', $database->jdbc); Notification::make() ->title(trans('admin/databasehost.rotated')) ->success() ->send(); } catch (Exception $exception) { Notification::make() ->title(trans('admin/databasehost.rotate_error')) ->body($exception->getMessage()) ->danger() ->send(); report($exception); } }); } }