mirror of
https://github.com/pelican-dev/panel.git
synced 2025-06-26 00:41:07 +02:00
75 lines
2.1 KiB
PHP
75 lines
2.1 KiB
PHP
<?php
|
|
|
|
namespace App\Filament\Admin\Resources;
|
|
|
|
use App\Filament\Admin\Resources\EggResource\RelationManagers\ServersRelationManager;
|
|
use App\Filament\Admin\Resources\EggResource\Pages\ListEggs;
|
|
use App\Filament\Admin\Resources\EggResource\Pages\CreateEgg;
|
|
use App\Filament\Admin\Resources\EggResource\Pages\EditEgg;
|
|
use App\Models\Egg;
|
|
use App\Traits\Filament\CanCustomizePages;
|
|
use App\Traits\Filament\CanCustomizeRelations;
|
|
use Filament\Resources\Pages\PageRegistration;
|
|
use Filament\Resources\RelationManagers\RelationManager;
|
|
use Filament\Resources\Resource;
|
|
|
|
class EggResource extends Resource
|
|
{
|
|
use CanCustomizePages;
|
|
use CanCustomizeRelations;
|
|
|
|
protected static ?string $model = Egg::class;
|
|
|
|
protected static string|\BackedEnum|null $navigationIcon = 'tabler-eggs';
|
|
|
|
protected static ?string $recordTitleAttribute = 'name';
|
|
|
|
public static function getNavigationBadge(): ?string
|
|
{
|
|
return ($count = static::getModel()::count()) > 0 ? (string) $count : null;
|
|
}
|
|
|
|
public static function getNavigationGroup(): ?string
|
|
{
|
|
return config('panel.filament.top-navigation', false) ? null : trans('admin/dashboard.server');
|
|
}
|
|
|
|
public static function getNavigationLabel(): string
|
|
{
|
|
return trans('admin/egg.nav_title');
|
|
}
|
|
|
|
public static function getModelLabel(): string
|
|
{
|
|
return trans('admin/egg.model_label');
|
|
}
|
|
|
|
public static function getPluralModelLabel(): string
|
|
{
|
|
return trans('admin/egg.model_label_plural');
|
|
}
|
|
|
|
public static function getGloballySearchableAttributes(): array
|
|
{
|
|
return ['name', 'tags', 'uuid', 'id'];
|
|
}
|
|
|
|
/** @return class-string<RelationManager>[] */
|
|
public static function getDefaultRelations(): array
|
|
{
|
|
return [
|
|
ServersRelationManager::class,
|
|
];
|
|
}
|
|
|
|
/** @return array<string, PageRegistration> */
|
|
public static function getDefaultPages(): array
|
|
{
|
|
return [
|
|
'index' => ListEggs::route('/'),
|
|
'create' => CreateEgg::route('/create'),
|
|
'edit' => EditEgg::route('/{record}/edit'),
|
|
];
|
|
}
|
|
}
|