Extra route parameter for a resource
Hello!
I have a resource that needs an extra parameter so I've added it to pages definition:
But, when I access the page (...geography/sub-destinations/1), I get a "Missing required parameter" error.
What am I missing here?
6 Replies
I tried to get the parameter from route but, in getPages() method, request()->route() is null.
Nobody has any idea?
What do you see if you run
php artisan route:list --name=filament.adminhub.geography.sub-destinations
it's
filament.adminhub.resources.geography.sub-destinations.index
and the result is:
GET|HEAD adminhub/geography/sub-destinations/{parent} ...................... filament.adminhub.resources.geography.sub-destinations.index › App\Filament\Admin\Resources\Geography\SubDestinationResource\Pages\ListSubDestinations
probably something related to lifecycle, if I make the parameter optional it works, but it's a required one...Ah, you may need set the following on the ListSubdestinations page:
protected static bool $shouldRegisterNavigation = false;
It's probably trying to register it as a navigation item by default, and it will be passing null
to the route generator.
That would explain why it's a UrlGenerationException
Nope, already did that...
Can you share more detail from the error? Where's it being found in the stack trace?
UrlGenerationException
suggests it's trying to generate the URL somewhere and not passing it a record