Files
laraundfelix/app/Filament/Resources/Compositions/Pages/ListCompositions.php
T
LarsandCursor 4f2e5a5f3b
Deploy Test / test (push) Successful in 14s
Deploy Test / deploy (push) Successful in 22s
Zeige Kurse im Mitgliederbereich und mach hochgeladene Fassungen ansehbar.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-15 10:27:20 +01:00

42 lines
1.5 KiB
PHP

<?php
namespace App\Filament\Resources\Compositions\Pages;
use App\Domain\Catalog\ContentService;
use App\Filament\Resources\Compositions\CompositionResource;
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;
class ListCompositions extends ListRecords
{
use ReportsDomainRules;
protected static string $resource = CompositionResource::class;
public function getSubheading(): string|Htmlable|null
{
return 'Hier entsteht der Kurs: fertige Fassungen in einer Reihenfolge, zum Beispiel Film und Merkblatt. Dieselbe Fassung kann in weiteren Kursen stecken. Verkauf und Rechte entstehen am Lizenzartikel, am Paket und am Angebot.';
}
protected function getHeaderActions(): array
{
return [
Action::make('create')
->label('Kurs anlegen')
->visible(fn (): bool => ContentElementResource::editor())
->schema([
TextInput::make('designation')->label('Bezeichnung')->required(),
])
->action(function (array $data): void {
$this->report(function () use ($data): void {
app(ContentService::class)->createComposition($data['designation']);
}, 'Der Kurs ist angelegt.');
}),
];
}
}