F
Filament3mo ago
Lloyd

Creating UUID (PK) in form

Hi folks, I require the UUID (which is the primary-key of my model, id) to be known before the user submits the form, as this will edit another field. Is there a way I can generate this UUID, set it to a TextInput, then use that as the primary ID? Thanks in advance.
2 Replies
ChesterS
ChesterS3mo ago
I guess either user ->default(Str::uuid()) or mutateFormDataBeforeCreate I guess the uuid needs to be filable in the method too. BTW if you're using Laravel's use HasUuid; you might not have to do any of those thigs
Lloyd
LloydOP3mo ago
I've tried that, but I need to use the ID to populate another field which is auto-generated. Even when I set Str::uuid(), its using a different ID. id is set to fillable on the model too Any hook I pass doesn't add any data at all I managed to fix this, thanks!
Want results from more Discord servers?
Add your server