Files
nuhodds_fi4/app/Filament/Resources/Events/EventResource.php
T
2025-12-06 10:18:04 +01:00

68 lines
1.7 KiB
PHP

<?php
namespace App\Filament\Resources\Events;
use App\Filament\Resources\Events\Pages\ListEvents;
use App\Filament\Resources\Events\Schemas\EventForm;
use App\Filament\Resources\Events\Tables\EventsTable;
use App\Models\Event;
use Carbon\Carbon;
use Filament\Resources\Resource;
use Filament\Schemas\Schema;
use Filament\Tables\Table;
use Illuminate\Database\Eloquent\Builder;
class EventResource extends Resource
{
protected static ?string $model = Event::class;
protected static string|\BackedEnum|null $navigationIcon = 'phosphor-monitor';
protected static ?string $navigationLabel = 'Monitor';
protected static ?string $modelLabel = 'Monitor';
protected static ?string $title = 'Monitor';
protected static ?string $pluralModelLabel = 'Monitor';
public static function getPluralModelLabel(): string
{
return '';
}
public static function form(Schema $schema): Schema
{
return EventForm::configure($schema);
}
public static function table(Table $table): Table
{
return EventsTable::configure($table);
}
public static function getRelations(): array
{
return [
//
];
}
public static function getPages(): array
{
return [
'index' => ListEvents::route('/'),
];
}
public static function getNavigationBadge(): ?string
{
return parent::getEloquentQuery()->withoutGlobalScopes()->where('starttime', '>', Carbon::now())->count();
}
public static function getEloquentQuery(): Builder
{
return parent::getEloquentQuery()->withoutGlobalScopes()->with('odds_3way')->where('starttime', '>', Carbon::now());
}
}