F
Filament14mo ago
mxc

Custom route with path parameters for custom page

Hi there, I have create a custom page with
php artisan make:filament-page MyPage
php artisan make:filament-page MyPage
I would like to change the path and add a path parameter but can't find how to do it. I read I should override the method "public static function route($record)" in my page class but this has had no effect. How do I modify the route for a generated custom page? Thanks
Solution:
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.
Jump to solution
3 Replies
DrByte
DrByte14mo ago
Is this page part of a Panel?
mxc
mxcOP14mo ago
Its a custom page that is on the admin panel. I tried with the method "public static route(): Route" in the pages class. Also "public statuc routes():array" but none of them work to override the url path. I then tried setting "protected static ?string $slug = 'custom-url-slug';" and this changes the route but if I want a path variable I get errors about it not being found . protected static ?string $slug = 'custom-url-slug/{id}'; I guess the question is how ddoes one customise routes and set parameters with filament.
Solution
mxc
mxc14mo ago
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.
Want results from more Discord servers?
Add your server