Best practice : Multiple pages on Resource

Hello, I have a more theorical than practical question : I make an application for yoga, trainings, workshops reservations. Each of these section of the menu has 3 pages : - List of objects (eg : list of yoga courses with CRUD) - List of events (eg : list of yoga sessions with CRUD on "Event" object) - Calendar of event (eg : list of yoga sessions in a calendar view (with Saade plugin) I tried to make 3 pages in my YogaResource folder but I can't find how to register navigation for a Page of a Resource ; these functions doesn't work :
protected static ?string $modelLabel = 'TEST';

public static function shouldRegisterNavigation(): bool
{
return true;
}
protected static ?string $modelLabel = 'TEST';

public static function shouldRegisterNavigation(): bool
{
return true;
}
Solution:
If these resources and pages are all part of a Panel, then you can register the Pages into the panel definition, or have the Panel auto-discover the pages in the Pages directory. eg: ```php ->discoverResources(in: app_path('Filament/App/Resources'), for: 'App\Filament\App\Resources')...
Jump to solution
2 Replies
Solution
DrByte
DrByte14mo ago
If these resources and pages are all part of a Panel, then you can register the Pages into the panel definition, or have the Panel auto-discover the pages in the Pages directory. eg:
->discoverResources(in: app_path('Filament/App/Resources'), for: 'App\\Filament\\App\\Resources')
->discoverPages(in: app_path('Filament/App/Pages'), for: 'App\\Filament\\App\\Pages')
->pages([
Pages\Dashboard::class,
])
->discoverResources(in: app_path('Filament/App/Resources'), for: 'App\\Filament\\App\\Resources')
->discoverPages(in: app_path('Filament/App/Pages'), for: 'App\\Filament\\App\\Pages')
->pages([
Pages\Dashboard::class,
])
SheepBild
SheepBildOP14mo ago
Ok thank you very much ! It worked perfectly
Want results from more Discord servers?
Add your server