kind(), [CompositionKind::Kurs, CompositionKind::Uebung], true) ? ' Programme und Module liegen gemeinsam auf dem Arbeitsplatz.' : ''; return $this->kind()->deskExplanation().$desk; } protected function getHeaderActions(): array { return [ Action::make('create') ->label(match ($this->kind()) { CompositionKind::Kurs => 'Programm anlegen', CompositionKind::Uebung => 'Modul anlegen', default => $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()); $slug = match ($this->kind()) { CompositionKind::Kurs => 'programm', CompositionKind::Uebung => 'modul', default => null, }; $editorial = $slug === null ? null : EditorialContentKind::query()->where('slug', $slug)->first(); if ($editorial !== null) { $composition->editorial_content_kind_id = $editorial->id; $composition->save(); } }, $this->kind()->label().' ist angelegt.'); if ($composition !== null) { $this->redirect(static::getResource()::getUrl('edit', ['record' => $composition])); } }), ]; } }