Race condition when modify record

Hi everyone, I'm new to Filament, I have a question: when 2 different users change data (update or delete) at the same time, how to prevent this? I have learned about the handleRecordUpdate function and used lockForUpdate when querying data to be updated, but what about deleting?
3 Replies
morty
morty2w ago
Can't you just use ->lockForUpdate() in the transaction for the delete as well?
Xuân Thiện
Xuân ThiệnOP2w ago
Of course it will work but as you can see, there is no function for me to override or define my own logic when deleting, the documentation only mentions handleRecordCreate and handleRecordUpdate.
morty
morty2w ago
Ah I see now I suppose you could use your own action instead of the default delete action. Seems like kind of a pain in the ass though

Did you find this page helpful?