kind(); } private function onDesk(): bool { return in_array($this->kind(), [CompositionKind::Kurs, CompositionKind::Uebung], true); } public function getSubheading(): string|Htmlable|null { $desk = $this->onDesk() ? ' Programme und Module stehen gemeinsam auch auf dem Arbeitsplatz.' : ''; return $this->kind()->deskExplanation().$desk; } public function getMaxContentWidth(): Width|string|null { return Width::Full; } public function content(Schema $schema): Schema { return $schema->components([View::make('filament.verwaltung.bestand')]); } protected function getHeaderActions(): array { if ($this->onDesk()) { return [$this->createCompositionAction($this->kind())]; } return [ Action::make('create') ->label($this->kind()->createLabel()) ->modalHeading('Neue '.lcfirst($this->kind()->label())) ->modalSubmitActionLabel($this->kind()->createLabel()) ->visible(fn (): bool => ContentElementResource::editor()) ->schema([ TextInput::make('designation')->label('Bezeichnung')->required(), ]) ->action(function (array $data): void { $composition = null; $this->report(function () use ($data, &$composition): void { $composition = app(ContentService::class)->createComposition($data['designation'], $this->kind()); }, $this->kind()->label().' ist angelegt.'); if ($composition !== null) { $this->redirect(static::getResource()::getUrl('edit', ['record' => $composition])); } }), ]; } }