filament-kanban
filament-kanban copied to clipboard
[Bug]: Error when we use UUID/ULID
What happened?
Hi Mokhosh!!
I am using ULID in the model, so when I try to drag the item to another status or edit it, an error occurs...
I found that the problem is that all declarations of the $recordId parameter were defined as integer
int $recordId
This way I found all the declarations and changed it to:
int|string $recordId
The changed methods were in the following files:
"src/Concerns/HasStatusChange.php"
"src/Concerns/HasEditRecordModal.php"
In this second file, we have the variable
public ?int $editModalRecordId = null;
Changed to:
public null|int|string $editModalRecordId = null;
And the method:
getEditModalFormSchema(?int $recordId)
Changed to
getEditModalFormSchema(null|int|string $recordId)
Important:
I also had to change the function calls:
onStatusChanged(int|string $recordId, ...)
getEditModalFormSchema(null|int|string $recordId, ...)
In the page generated through the "make" command.
Reminder: It is necessary to change the test files and functions generated in the "make" command
Well, I believe that as the use of UUID or ULID is common, this correction is interesting...
How to reproduce the bug
Use UUID or ULID as record IDs. Then try to change them...
Package Version
v2.3.0
PHP Version
8.1.10
Laravel Version
10.10
Which operating systems does with happen with?
Windows
Which browsers does with happen with?
Chrome
Notes
No response
Thanks for reporting. I'll look into it.
I wrote new tests for models using ulid, and tests are passing, but this will be a breaking change, as it will change the signature of some KanbanBoard
methods that are usually overrode.
I'll ship this in v3.
Great!! In my project the changes have already been made and so far everything is ok... Of course, if I need to update or, certainly, use it again I will go to version 3...
Thank you for your attention and for the code that worked perfectly for my needs!!
As a temporary fix:
-
Make the board extends Filament Page
class ToDoBoard extends Page implements HasForms
-
Copy all data (properties and methods) from
KanbanBoard
to your board and make$record_id
to be a string -
Create your own
HasEditRecordModal
andHasStatusChange
traits and make$record_id
to be a string
I got it working with UUID this way.
P.S.: Great work. Very usefull module.
hello, any updates regarding this feature?
As a temporary fix:
- Make the board extends Filament Page
class ToDoBoard extends Page implements HasForms
- Copy all data (properties and methods) from
KanbanBoard
to your board and make$record_id
to be a string- Create your own
HasEditRecordModal
andHasStatusChange
traits and make$record_id
to be a stringI got it working with UUID this way.
P.S.: Great work. Very usefull module.
thanks, this worked for me too