Mache Medien, Übungen und Kurse in der Verwaltung bearbeitbar.
Deploy Test / test (push) Successful in 13s
Deploy Test / deploy (push) Successful in 23s

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
LarsandCursor committed 2026-11-15 10:49:35 +01:00
1 parent 4f2e5a5f3b
commit 3ee9f529ca
33 files changed
+1105 -284

No files matched your search

@@ -0,0 +1,46 @@
<?php
namespace App\Filament\Resources\Compositions\Pages;
use App\Domain\Catalog\CompositionKind;
use App\Domain\Catalog\ContentService;
use App\Filament\Resources\ContentElements\ContentElementResource;
use App\Filament\Support\ReportsDomainRules;
use Filament\Actions\Action;
use Filament\Forms\Components\TextInput;
use Filament\Resources\Pages\ListRecords;
use Illuminate\Contracts\Support\Htmlable;
abstract class ListCompositionKind extends ListRecords
{
use ReportsDomainRules;
abstract protected function kind(): CompositionKind;
public function getSubheading(): string|Htmlable|null
{
return $this->kind()->explanation();
}
protected function getHeaderActions(): array
{
return [
Action::make('create')
->label($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]));
}
}),
];
}
}