55 lines
1.6 KiB
PHP
55 lines
1.6 KiB
PHP
<?php
|
|
|
|
namespace App\Filament\Clusters\StaticData\Resources\UbEvents;
|
|
|
|
use App\Filament\Clusters\StaticData\Resources\UbEvents\Pages\ListUbEvents;
|
|
use App\Filament\Clusters\StaticData\Resources\UbEvents\Schemas\UbEventForm;
|
|
use App\Filament\Clusters\StaticData\Resources\UbEvents\Tables\UbEventsTable;
|
|
use App\Filament\Clusters\StaticData\StaticDataCluster;
|
|
use App\Models\UbEvent;
|
|
use BackedEnum;
|
|
use Filament\Resources\Resource;
|
|
use Filament\Schemas\Schema;
|
|
use Filament\Tables\Table;
|
|
use Illuminate\Contracts\Support\Htmlable;
|
|
|
|
class UbEventResource extends Resource
|
|
{
|
|
protected static ?string $model = UbEvent::class;
|
|
|
|
protected static string|BackedEnum|null $navigationIcon = 'icon-soccerball';
|
|
|
|
protected static ?string $navigationLabel = 'Events & Player';
|
|
|
|
protected static ?string $cluster = StaticDataCluster::class;
|
|
|
|
// protected static ?string $recordTitleAttribute = 'league_id';
|
|
|
|
public static function getRecordTitle($record): string|null|Htmlable
|
|
{
|
|
return ': '.$record->starttime->format('d. M. Y').' - '.$record->league->name.' - '.$record->home->name.' vs '.$record->away->name.' - '.$record->player->name;
|
|
}
|
|
|
|
public static function form(Schema $schema): Schema
|
|
{
|
|
return UbEventForm::configure($schema);
|
|
}
|
|
|
|
public static function table(Table $table): Table
|
|
{
|
|
return UbEventsTable::configure($table);
|
|
}
|
|
|
|
public static function getPages(): array
|
|
{
|
|
return [
|
|
'index' => ListUbEvents::route('/'),
|
|
];
|
|
}
|
|
|
|
public static function getNavigationBadge(): ?string
|
|
{
|
|
return parent::getEloquentQuery()->count();
|
|
}
|
|
}
|