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 only keeps its settings; there is no connection to configure. if ($record instanceof Channel && $record->isWebsite()) { $record->update(['process_overrides' => $data['process_overrides'] ?? []]); return $record; } return app(ConfigureChannel::class)->handle($record->property, $data, $record); } protected function getRedirectUrl(): string { return ChannelResource::getUrl('index'); } }