Passing parameters to a custom page

Hello all, could anyone please help me with passing parameters to a custom page (not associated with any resource)? I am doing something wrong here?
Route::get('/trainer/attendee-sheet/{id}', \App\Filament\Trainer\Pages\AttendeeSheet::class)
->name('filament.trainer.pages.attendee-sheet');
Route::get('/trainer/attendee-sheet/{id}', \App\Filament\Trainer\Pages\AttendeeSheet::class)
->name('filament.trainer.pages.attendee-sheet');
This works when I accept the parameter in livewire style but the filament shows the Admin panel's menu when I send the parameter. /trainer/attendee-sheet/12 -> This page shows the admin panel's navigation. /trainer/attendee-sheet -> This page shows correct navigation.
Solution:
worked using this, ```php public static function getSlug(): string {...
Jump to solution
4 Replies
Solution
Sanchit Patil
Sanchit Patil15mo ago
worked using this,
public static function getSlug(): string
{
return 'attendee-sheet/{id}';
}
public static function getSlug(): string
{
return 'attendee-sheet/{id}';
}
mxc
mxc14mo ago
How do you get it not to generate a Route name like this: GET|HEAD admin/customer/{id} filament.admin.pages.customer.{id} Ok the error is due to as I had it registered for navigation and it requires an id in the url. I removed it from the navigation component with "protected static bool $shouldRegisterNavigation = false;" Now it works.
Samir
Samir13mo ago
Hi @Sanchit Patil ... I am encountering similar challenge. But I could not understand your solution. My Filament Custom Page always shows Admin panel selective navigation in both public and private view. It is not working for me using parameter. Would you mind elaboring where to use getSlug().
Sanchit Patil
Sanchit PatilOP13mo ago
are you getting this issue due to the custom page? because I got this issue while trying to pass a parameter to the custom page URL. first, i tried the way we do it with Livewire full-page component
Route::get('/trainer/attendee-sheet/{id}', \App\Filament\Trainer\Pages\AttendeeSheet::class)
->name('filament.trainer.pages.attendee-sheet');
Route::get('/trainer/attendee-sheet/{id}', \App\Filament\Trainer\Pages\AttendeeSheet::class)
->name('filament.trainer.pages.attendee-sheet');
php this works but, the filament started showing the Admin panel's menu when I sent the parameter (the page is not associated with the admin panel). so tried it in the getSlug function and accessed in the mount function and it worked.
Want results from more Discord servers?
Add your server