Custom route with path parameters for custom page
Hi there,
I have create a custom page with
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:Jump to 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.
3 Replies
Is this page part of a Panel?
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
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.