Files
laraundfelix/app/Filament/Resources/Pillars/PillarResource.php
T
LarsandCursor af85a94cd5
Deploy Test / test (push) Successful in 15s
Deploy Test / deploy (push) Successful in 22s
Zeige Medienfassungen in der Verwaltung und halte Beschreibungen davon getrennt.
Eine Fassung bleibt nummeriert und kann deaktiviert werden. Beschreibung und fachliche Säulen gehören zum Medium und legen keine neue Fassung an.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-15 11:25:08 +01:00

68 lines
1.9 KiB
PHP

<?php
namespace App\Filament\Resources\Pillars;
use App\Domain\Catalog\Pillar;
use App\Filament\Resources\ContentElements\ContentElementResource;
use App\Filament\Resources\Pillars\Pages\EditPillar;
use App\Filament\Resources\Pillars\Pages\ListPillars;
use Filament\Forms\Components\TextInput;
use Filament\Resources\Resource;
use Filament\Schemas\Schema;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Table;
use Illuminate\Auth\Access\Response;
use Illuminate\Database\Eloquent\Model;
class PillarResource extends Resource
{
protected static ?string $model = Pillar::class;
protected static string|\UnitEnum|null $navigationGroup = 'Inhalte';
protected static ?string $navigationLabel = 'Fachliche Säulen';
protected static ?string $modelLabel = 'Fachliche Säule';
protected static ?string $pluralModelLabel = 'Fachliche Säulen';
protected static ?string $recordTitleAttribute = 'name';
protected static ?string $slug = 'saeulen';
protected static ?int $navigationSort = 5;
public static function canViewAny(): bool
{
return ContentElementResource::editor();
}
public static function getEditAuthorizationResponse(Model $record): Response
{
return ContentElementResource::editor() ? Response::allow() : Response::deny();
}
public static function form(Schema $schema): Schema
{
return $schema->components([
TextInput::make('name')->label('Name')->required(),
]);
}
public static function table(Table $table): Table
{
return $table->columns([
TextColumn::make('name')->label('Name')->searchable(),
TextColumn::make('elements_count')->counts('elements')->label('Medien'),
]);
}
public static function getPages(): array
{
return [
'index' => ListPillars::route('/'),
'edit' => EditPillar::route('/{record}'),
];
}
}