mirror of
https://github.com/pelican-dev/panel.git
synced 2025-05-24 09:34:44 +02:00

* Reduce Reuse Reduce the repetitiveness of \Form\Component\Blah along with all the others... * PHPStan Fix
41 lines
1.1 KiB
PHP
41 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Filament\Resources;
|
|
|
|
use App\Filament\Resources\NodeResource\Pages;
|
|
use App\Filament\Resources\NodeResource\RelationManagers\AllocationsRelationManager;
|
|
use App\Filament\Resources\NodeResource\RelationManagers\NodesRelationManager;
|
|
use App\Models\Node;
|
|
use Filament\Resources\Resource;
|
|
|
|
class NodeResource extends Resource
|
|
{
|
|
protected static ?string $model = Node::class;
|
|
|
|
protected static ?string $navigationIcon = 'tabler-server-2';
|
|
|
|
protected static ?string $recordTitleAttribute = 'name';
|
|
|
|
public static function getNavigationBadge(): ?string
|
|
{
|
|
return static::getModel()::count() ?: null;
|
|
}
|
|
|
|
public static function getRelations(): array
|
|
{
|
|
return [
|
|
AllocationsRelationManager::class,
|
|
NodesRelationManager::class,
|
|
];
|
|
}
|
|
|
|
public static function getPages(): array
|
|
{
|
|
return [
|
|
'index' => Pages\ListNodes::route('/'),
|
|
'create' => Pages\CreateNode::route('/create'),
|
|
'edit' => Pages\EditNode::route('/{record}/edit'),
|
|
];
|
|
}
|
|
}
|