Mache die Inhaltsverwaltung fuer die Redaktion bedienbar
Deploy Test / test (push) Successful in 18s
Deploy Test / deploy (push) Successful in 22s

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
LarsandCursor committed 2026-11-16 08:59:30 +01:00
1 parent 9b52181be1
commit d6ff881e4e
10 files changed
+371 -49

No files matched your search

@@ -4,6 +4,7 @@
use App\Domain\Catalog\CompositionKind;
use App\Domain\Catalog\ContentService;
use App\Domain\Catalog\EditorialContentKind;
use App\Filament\Resources\ContentElements\ContentElementResource;
use App\Filament\Support\ReportsDomainRules;
use Filament\Actions\Action;
@@ -26,7 +27,11 @@ protected function getHeaderActions(): array
{
return [
Action::make('create')
->label($this->kind()->createLabel())
->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(),
@@ -35,6 +40,16 @@ protected function getHeaderActions(): array
$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) {