label('Ablauf')->url(fn (): string => ChannelResource::getUrl('process', ['record' => $this->record])), Action::make('rules')->label('Regeln & Exportfelder')->url(fn (): string => ChannelResource::getUrl('rules', ['record' => $this->record]))->visible(fn (): bool => $this->record->isPortal()), Action::make('analyze')->label('Kalender analysieren')->visible(fn (): bool => $this->record->isPortal())->action(function (AnalyzeChannelCalendar $analyze): void { try { $analyze->handle($this->record); $this->redirect(ChannelResource::getUrl('rules', ['record' => $this->record])); } catch (ChannelSyncException $exception) { Notification::make()->title('Analyse nicht möglich')->body($exception->getMessage())->danger()->send(); } }), ]; } protected function mutateFormDataBeforeFill(array $data): array { return [...$data, 'settings' => $this->record->settings]; } protected function handleRecordUpdate(Model $record, array $data): Model { // The own website's entry has no connection to configure; its process is set up under "Ablauf" (ChannelProcess). if ($record instanceof Channel && $record->isWebsite()) { return $record; } return app(ConfigureChannel::class)->handle($record->property, $data, $record); } protected function getRedirectUrl(): string { return ChannelResource::getUrl('index'); } }