|
| 1 | +<?php |
| 2 | + |
| 3 | +declare(strict_types=1); |
| 4 | + |
| 5 | +namespace App\Filament\Resources\Appointments; |
| 6 | + |
| 7 | +use App\Filament\Resources\Appointments\Pages\CalendarAppointments; |
| 8 | +use App\Filament\Resources\Appointments\Pages\CreateAppointment; |
| 9 | +use App\Filament\Resources\Appointments\Pages\EditAppointment; |
| 10 | +use App\Filament\Resources\Appointments\Pages\ListAppointments; |
| 11 | +use App\Filament\Resources\Appointments\Pages\ViewAppointment; |
| 12 | +use App\Filament\Resources\Appointments\RelationManagers\InterventionsRelationManager; |
| 13 | +use App\Filament\Resources\Appointments\Schemas\AppointmentForm; |
| 14 | +use App\Filament\Resources\Appointments\Schemas\AppointmentInfolist; |
| 15 | +use App\Filament\Resources\Appointments\Tables\AppointmentsTable; |
| 16 | +use App\Models\Appointment; |
| 17 | +use BackedEnum; |
| 18 | +use Filament\Resources\Resource; |
| 19 | +use Filament\Schemas\Schema; |
| 20 | +use Filament\Support\Icons\Heroicon; |
| 21 | +use Filament\Tables\Table; |
| 22 | + |
| 23 | +class AppointmentResource extends Resource |
| 24 | +{ |
| 25 | + protected static ?string $model = Appointment::class; |
| 26 | + |
| 27 | + protected static ?int $navigationSort = 3; |
| 28 | + |
| 29 | + protected static string | BackedEnum | null $navigationIcon = Heroicon::CalendarDateRange; |
| 30 | + |
| 31 | + public static function getModelLabel(): string |
| 32 | + { |
| 33 | + return __('appointment.label.singular'); |
| 34 | + } |
| 35 | + |
| 36 | + public static function getPluralModelLabel(): string |
| 37 | + { |
| 38 | + return __('appointment.label.plural'); |
| 39 | + } |
| 40 | + |
| 41 | + public static function form(Schema $schema): Schema |
| 42 | + { |
| 43 | + return AppointmentForm::configure($schema); |
| 44 | + } |
| 45 | + |
| 46 | + public static function infolist(Schema $schema): Schema |
| 47 | + { |
| 48 | + return AppointmentInfolist::configure($schema); |
| 49 | + } |
| 50 | + |
| 51 | + public static function table(Table $table): Table |
| 52 | + { |
| 53 | + return AppointmentsTable::configure($table); |
| 54 | + } |
| 55 | + |
| 56 | + public static function getRelations(): array |
| 57 | + { |
| 58 | + return [ |
| 59 | + InterventionsRelationManager::class, |
| 60 | + ]; |
| 61 | + } |
| 62 | + |
| 63 | + public static function getPages(): array |
| 64 | + { |
| 65 | + return [ |
| 66 | + 'index' => CalendarAppointments::route('/'), |
| 67 | + 'list' => ListAppointments::route('/list'), |
| 68 | + 'create' => CreateAppointment::route('/create'), |
| 69 | + 'view' => ViewAppointment::route('/{record}'), |
| 70 | + 'edit' => EditAppointment::route('/{record}/edit'), |
| 71 | + ]; |
| 72 | + } |
| 73 | +} |
0 commit comments