mirror of
https://github.com/Cybrarist/Discount-Bandit.git
synced 2026-11-24 19:49:54 +01:00
62 lines
1.6 KiB
PHP
62 lines
1.6 KiB
PHP
<?php
|
|
|
|
namespace App\Filament\Resources\Stores;
|
|
|
|
use App\Enums\RoleEnum;
|
|
use App\Filament\Resources\Stores\Pages\CreateStore;
|
|
use App\Filament\Resources\Stores\Pages\EditStore;
|
|
use App\Filament\Resources\Stores\Pages\ListStores;
|
|
use App\Filament\Resources\Stores\Pages\ViewStore;
|
|
use App\Filament\Resources\Stores\Schemas\StoreForm;
|
|
use App\Filament\Resources\Stores\Tables\StoresTable;
|
|
use App\Models\Store;
|
|
use BackedEnum;
|
|
use Filament\Resources\Resource;
|
|
use Filament\Schemas\Schema;
|
|
use Filament\Support\Icons\Heroicon;
|
|
use Filament\Tables\Table;
|
|
use Illuminate\Support\Facades\Auth;
|
|
|
|
class StoreResource extends Resource
|
|
{
|
|
protected static ?string $model = Store::class;
|
|
|
|
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedRectangleStack;
|
|
|
|
protected static ?string $recordTitleAttribute = 'name';
|
|
|
|
protected static ?int $navigationSort = 4;
|
|
|
|
public static function canAccess(): bool
|
|
{
|
|
return Auth::user()->role === RoleEnum::Admin;
|
|
}
|
|
|
|
public static function form(Schema $schema): Schema
|
|
{
|
|
return StoreForm::configure($schema);
|
|
}
|
|
|
|
public static function table(Table $table): Table
|
|
{
|
|
return StoresTable::configure($table);
|
|
}
|
|
|
|
public static function getRelations(): array
|
|
{
|
|
return [
|
|
//
|
|
];
|
|
}
|
|
|
|
public static function getPages(): array
|
|
{
|
|
return [
|
|
'index' => ListStores::route('/'),
|
|
'create' => CreateStore::route('/create'),
|
|
'view' => ViewStore::route('/{record}'),
|
|
'edit' => EditStore::route('/{record}/edit'),
|
|
];
|
|
}
|
|
}
|