F
Filament14mo ago
Connor

Running something when save changes is clicked.

So I have a page for Products, where a user can edit a products information. I want to be able to pass that info back to stripe to update the product externally so I'd like it to run this process when the Edit product form saves but not quite sure how or where i inject this code. Appreciate the help!
Solution:
use mutateFormDataBeforeSave() in the EditProduct page
Jump to solution
5 Replies
DrByte
DrByte14mo ago
Assuming you're using a Filament Form, have you explored using ->afterStateUpdated() ? https://filamentphp.com/docs/3.x/forms/advanced#field-updates
Connor
ConnorOP14mo ago
This could work but I kind of need something to run after every save regardless of values changing for specific fields so im not sure if its best suited So I have found a method for the CreateProduct page,
mutateFormDataBeforeCreate()
mutateFormDataBeforeCreate()
where I can do things with the data before creating, however I also need this for updating but unsure how todo this still
Solution
MohamedSabil83
MohamedSabil8314mo ago
use mutateFormDataBeforeSave() in the EditProduct page
Connor
ConnorOP14mo ago
That makes sense thank you!
MohamedSabil83
MohamedSabil8314mo ago
Glad to assist you
Want results from more Discord servers?
Add your server