phplaravellaravel-filament

UUID's with Laravel and Filament gives incorrect edit url link


When you have an entity that uses a UUID as it's primary key, Filament will be able to generate a new entity for you but when clicking on the edit button, it directs you to the wrong url which results in a 404.

For example imagine having an entity with uuid 63f3cadb-f149-4fa6-a316-6be32592f34d then instead of the resulting url being /63f3cadb-f149-4fa6-a316-6be32592f34d/edit it will be /63/edit. It converts the string into an integer.

Is this something that is missing from Filament or the Filament docs or am I missing something?

Current workaround is having an auto increment id and a uuid for each entry. But this is not ideal.

Thank you in advance for your response!


Solution

  • try on your model

    protected $casts = ['id' => 'string'];
    protected $keyType = 'string';