Csak lista + megtekintés a gyártón (nincs create/edit/delete, ahogy eddig sem volt admin felület), az AliasesRelationManager viszont teljes CRUD-ot ad az aliasokon - felvétel a ProducerAliasResolver ütközés-védelmén át, törlés. Felkerült egy "Gyártók" menüpont mindkét navbarba. A Filament panel alapból read-only-vá tesz minden relation managert a View oldalon, mert a ProducerResource-nak nincs Edit oldala - ezt csak a Livewire-teszt buktatta le, az AliasesRelationManager::isReadOnly() explicit felülírással oldva.
65 lines
1.8 KiB
PHP
65 lines
1.8 KiB
PHP
<?php
|
|
|
|
namespace App\Filament\Resources\Producers;
|
|
|
|
use App\Filament\Resources\Producers\Pages\ListProducers;
|
|
use App\Filament\Resources\Producers\Pages\ViewProducer;
|
|
use App\Filament\Resources\Producers\RelationManagers\AliasesRelationManager;
|
|
use App\Filament\Resources\Producers\Schemas\ProducerInfolist;
|
|
use App\Filament\Resources\Producers\Tables\ProducersTable;
|
|
use App\Models\Producer;
|
|
use BackedEnum;
|
|
use Filament\Resources\Resource;
|
|
use Filament\Schemas\Schema;
|
|
use Filament\Tables\Table;
|
|
|
|
/**
|
|
* Csak lista + megtekintés: gyártó ma is kizárólag árlista importból keletkezik, itt
|
|
* nincs create/edit/delete. A felület egyetlen célja az aliasok kezelése (lásd
|
|
* AliasesRelationManager) - EV3-473.
|
|
*/
|
|
class ProducerResource extends Resource
|
|
{
|
|
protected static ?string $model = Producer::class;
|
|
|
|
protected static string|BackedEnum|null $navigationIcon = 'heroicon-o-building-storefront';
|
|
|
|
protected static ?string $navigationLabel = 'Gyártók';
|
|
|
|
protected static ?string $modelLabel = 'Gyártó';
|
|
|
|
protected static ?string $pluralLabel = 'Gyártók';
|
|
|
|
protected static ?string $breadcrumb = 'Gyártók';
|
|
|
|
public static function infolist(Schema $schema): Schema
|
|
{
|
|
return ProducerInfolist::configure($schema);
|
|
}
|
|
|
|
public static function table(Table $table): Table
|
|
{
|
|
return ProducersTable::configure($table);
|
|
}
|
|
|
|
public static function getRelations(): array
|
|
{
|
|
return [
|
|
AliasesRelationManager::class,
|
|
];
|
|
}
|
|
|
|
public static function getPages(): array
|
|
{
|
|
return [
|
|
'index' => ListProducers::route('/'),
|
|
'view' => ViewProducer::route('/{record}'),
|
|
];
|
|
}
|
|
|
|
public static function canCreate(): bool
|
|
{
|
|
return false;
|
|
}
|
|
}
|