FilamentF
Filamentโ€ข3y ago
Gunnolfson

Change resource ID for FileUpload form field

Hi

I did some few things to have a ULID encoded as binary(16) (needed as the Backoffice would be made from Laravel Filament, because that's the best option I know, but the project isn't a Laravel project, and that's why it is not a char(26) as Laravel handle by default)
Thing is I thus need to change things like user provider, resolve router binding etc to use a decoder on the ulid value (the value stored in DB is a binary value, the one managed by Laravel is a string, thanks to casting).
Here's what it looks like
public function retrieveById($identifier): Model|Builder|Authenticatable|null
{
    $identifier = Ulid::fromString($identifier)->toBinary();
    $model = $this->createModel();

    return $this->newModelQuery($model)
        ->where($model->getAuthIdentifierName(), $identifier)
        ->first();
}

However, when I come on an edit page for resource with a FileUpload field, I get a popup window with 404 ๐Ÿ˜ Is there anything I can do to debug it and fix it?
Was this page helpful?