Öffne Katalog, Bibliothek und Testkauf für den MVP.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
463851d402
commit
fd6860efda
51 files changed
+2331
-31
No files matched your search
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\ContentElements;
|
||||
|
||||
use App\Domain\Catalog\ContentElement;
|
||||
use App\Domain\Identity\StaffRole;
|
||||
use App\Filament\Resources\ContentElements\Pages\ListContentElements;
|
||||
use App\Models\User;
|
||||
use Filament\Facades\Filament;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class ContentElementResource extends Resource
|
||||
{
|
||||
protected static ?string $model = ContentElement::class;
|
||||
|
||||
protected static string|\UnitEnum|null $navigationGroup = 'Redaktion';
|
||||
|
||||
protected static ?string $navigationLabel = 'Inhaltselemente';
|
||||
|
||||
protected static ?string $modelLabel = 'Inhaltselement';
|
||||
|
||||
protected static ?string $pluralModelLabel = 'Inhaltselemente';
|
||||
|
||||
protected static ?string $recordTitleAttribute = 'working_title';
|
||||
|
||||
public static function canViewAny(): bool
|
||||
{
|
||||
return self::editor();
|
||||
}
|
||||
|
||||
public static function editor(): bool
|
||||
{
|
||||
$user = Filament::auth()->user();
|
||||
|
||||
return $user instanceof User && $user->hasStaffRole(StaffRole::Redakteur);
|
||||
}
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return $schema;
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return $table->columns([
|
||||
TextColumn::make('working_title')->label('Arbeitstitel')->searchable(),
|
||||
TextColumn::make('kind')->label('Art'),
|
||||
TextColumn::make('output_class')->label('Ausgabeklasse'),
|
||||
TextColumn::make('versions_count')->counts('versions')->label('Fassungen'),
|
||||
])->recordUrl(null);
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => ListContentElements::route('/'),
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user