Self-Healing URL's
I use this package to implement 'self-healing urls': https://github.com/lukeraymonddowning/self-healing-urls
It functions great and fulfills my website's requirements. One modification I made was to use an alternative ID instead of Laravel's default primaryKey. To accomplish this, I implemented an override:
In the frontend, everything functions perfectly. The system effectively resolves my models in both directions and automatically corrects URLs.
However, I encounter issues in the backend. Although the new URL is visible in my table, clicking on it results in a 404 error. Consequently, navigation to pages such as the edit page is unsuccessful. I am not sure about the next steps to address this issue. My assumption was that Filament adheres to the routing system, but it seems the package might be operating differently. Maybe someone has an idea on to resolve this?
GitHub
GitHub - lukeraymonddowning/self-healing-urls: A Laravel package th...
A Laravel package that allows you to define self-healing URLs for Eloquent models - GitHub - lukeraymonddowning/self-healing-urls: A Laravel package that allows you to define self-healing URLs for ...
8 Replies
Try adding this to the resource file
Yes, already tried it, but no luck 🤔
What exactly is the issue? The links use the correct ID but when you click on them filament doesn't find them and returns a 404? Is the query that is executed correct?
Sounds like you need a way in the self healing URLs to exclude the panel’s path. I really don’t see the use in the context of the admin / panel / crud context.
Is there a way to have both? I wanted to use UUIDs for the public facing panels and numeric IDs for admin panels, but I couldn't find a way to do that. I had to use the same for both (UUID) because I needed to override the
getRouteKeyName
methodHonestly, I don’t know, but I would hope that the healing URLs package has a way to disable its middleware for specific routes.
Thanks. I will see if something like that is possible.
OK, if I make these changes it works:
In my Resource I added:
protected static ?string $recordRouteKeyName = 'id';
In the getPages
function I changed the edit method to this:
'edit' => Pages\EditModel::route('/{record:id}/edit'),
So now it handles both scenarios. 🙂doesnt work with the current version?