52 lines
1.4 KiB
PHP
52 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace App\Filament\Resources\Compositions;
|
|
|
|
use App\Domain\Catalog\Composition;
|
|
use App\Filament\Resources\Compositions\Pages\ListCompositions;
|
|
use App\Filament\Resources\ContentElements\ContentElementResource;
|
|
use Filament\Resources\Resource;
|
|
use Filament\Schemas\Schema;
|
|
use Filament\Tables\Columns\TextColumn;
|
|
use Filament\Tables\Table;
|
|
|
|
class CompositionResource extends Resource
|
|
{
|
|
protected static ?string $model = Composition::class;
|
|
|
|
protected static string|\UnitEnum|null $navigationGroup = 'Redaktion';
|
|
|
|
protected static ?string $navigationLabel = 'Kompositionen';
|
|
|
|
protected static ?string $modelLabel = 'Komposition';
|
|
|
|
protected static ?string $pluralModelLabel = 'Kompositionen';
|
|
|
|
protected static ?string $recordTitleAttribute = 'designation';
|
|
|
|
public static function canViewAny(): bool
|
|
{
|
|
return ContentElementResource::editor();
|
|
}
|
|
|
|
public static function form(Schema $schema): Schema
|
|
{
|
|
return $schema;
|
|
}
|
|
|
|
public static function table(Table $table): Table
|
|
{
|
|
return $table->columns([
|
|
TextColumn::make('designation')->label('Bezeichnung')->searchable(),
|
|
TextColumn::make('versions_count')->counts('versions')->label('Fassungen'),
|
|
])->recordUrl(null);
|
|
}
|
|
|
|
public static function getPages(): array
|
|
{
|
|
return [
|
|
'index' => ListCompositions::route('/'),
|
|
];
|
|
}
|
|
}
|