Multiple slashes (/) in the slug lead to 404
I have an Eloquent model
Category
. It has a slug that has multiple slashes, like animals-pet-supplies/pet-supplies/bird-supplies/bird-cage-accessories/bird-cage-bird-baths
etc.
The problem is that for this route:
'edit' => Pages\EditCategory::route('/{record}/edit'),
I get a 404, probably because of multiple slashes. In Laravel router, I did this ->where('category', '.*')
, which helped. Is there any way to do this in Filament? It's also OK to just use the ID, not the slug, but I have no idea how to do that.
I tried protected static ?string $recordRouteKeyName = 'id';
with no luck.Solution:Jump to solution
```public static function getPages(): array
{
return [
'index' => Pages\ListCategories::route('/'),
'create' => Pages\CreateCategory::route('/create'),...
3 Replies
YourResource::getUrl('edit', ['record' => $customer]);
$customer is can be model or id. This gives a edit url
thanks, I'm trying that, but I must be missing something. I don't have the model in this static context:
Solution
Then for example