mirror of
https://github.com/pelican-dev/panel.git
synced 2025-06-15 17:31:07 +02:00
58 lines
1.6 KiB
PHP
58 lines
1.6 KiB
PHP
<?php
|
|
|
|
namespace App\Filament\Server\Resources;
|
|
|
|
use App\Filament\Server\Resources\AllocationResource\Pages;
|
|
use App\Models\Allocation;
|
|
use App\Models\Permission;
|
|
use App\Traits\Filament\BlockAccessInConflict;
|
|
use App\Traits\Filament\CanCustomizePages;
|
|
use App\Traits\Filament\CanCustomizeRelations;
|
|
use Filament\Facades\Filament;
|
|
use Filament\Resources\Resource;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class AllocationResource extends Resource
|
|
{
|
|
use BlockAccessInConflict;
|
|
use CanCustomizePages;
|
|
use CanCustomizeRelations;
|
|
|
|
protected static ?string $model = Allocation::class;
|
|
|
|
protected static ?string $modelLabel = 'Network';
|
|
|
|
protected static ?string $pluralModelLabel = 'Network';
|
|
|
|
protected static ?int $navigationSort = 7;
|
|
|
|
protected static ?string $navigationIcon = 'tabler-network';
|
|
|
|
public static function canViewAny(): bool
|
|
{
|
|
return auth()->user()->can(Permission::ACTION_ALLOCATION_READ, Filament::getTenant());
|
|
}
|
|
|
|
public static function canCreate(): bool
|
|
{
|
|
return auth()->user()->can(Permission::ACTION_ALLOCATION_CREATE, Filament::getTenant());
|
|
}
|
|
|
|
public static function canEdit(Model $record): bool
|
|
{
|
|
return auth()->user()->can(Permission::ACTION_ALLOCATION_UPDATE, Filament::getTenant());
|
|
}
|
|
|
|
public static function canDelete(Model $record): bool
|
|
{
|
|
return auth()->user()->can(Permission::ACTION_ALLOCATION_DELETE, Filament::getTenant());
|
|
}
|
|
|
|
public static function getDefaultPages(): array
|
|
{
|
|
return [
|
|
'index' => Pages\ListAllocations::route('/'),
|
|
];
|
|
}
|
|
}
|