How to use filament table when record key is not an integer?
I published the sessions table.
I created a filament resource for the sessions table.
The issue comes when i try to delete multiple rows via it's table. It just deletes them all.
I guess this is because the sessions table doesn't have a "regular id" field, but instead has a id varchar column type. (
$table->string('id')->primary();
)
So seems filament expect the id to be an integer, and somehow cant handle it and selects all the records in the table.
Im not sure if the table record key can be changed or what should i do to make it work
in all my other resources, bulk actions just work fine, is just with this table, which has the id primary key not integer7 Replies
How did you configure the model? You would probably need to override these parameters in there
Set $incrementing to false and $keyType to 'string' and see if that works
Is there a reason you have to set the key as a string type? Can't you have the id set to bigInteger like the rest and add a unique "reference" or "code" column?
so far i have it like this:
ill try to configure it as u say, lets see
idk, i just use the default laravel session table structure
seems
protected $keyType = 'string';
does the trick! it works. thanks πawesome!
glad to help
ud change the table session structure?
i mean, i wont just in case. idk how laravel handles that table behind the scenes
To be honest I never used sessions with database, but yeah I would keep it as it comes by default