label('Löschen') ->color('danger') ->requiresConfirmation() ->action(function (): void { /** @var Pillar $pillar */ $pillar = $this->getRecord(); $deleted = false; $this->report(function () use ($pillar, &$deleted): void { app(PillarService::class)->delete($pillar); $deleted = true; }, 'Die Säule ist gelöscht.'); if ($deleted) { $this->redirect(PillarResource::getUrl('index')); } }), ]; } protected function handleRecordUpdate(Model $record, array $data): Model { /** @var Pillar $record */ try { app(PillarService::class)->rename($record, $data['name']); } catch (DomainRuleException $exception) { Notification::make()->title($exception->getMessage())->danger()->send(); throw new Halt; } return $record; } }