Multiple Actions on Save
I'm new to Filament, and Laravel in general...sorry in advance if I've missed something elementary. I've got a long way on my own, but hit a brick wall on this one.
Resource setup (with relationship too, but unrelated for this question), and working perfectly for creating, deleting and editing.
At this point, my question relates to being in an existing record and making changes. When pressing save, I want to save the record + fire off a webhook to trigger a third party.
I've fired up Webhooks, and can a call it from a separate action button on my form. I just can't combine them!
The below code is located in my ''Edit Page' of the resource, and fires off my function to send the webhook. It doesn't save the record.
Anyone able to show me how I can include the save command in the same action?
Thanks in advance.
Solution:Jump to solution
Here, lifecycle hooks should be the means of handling the thing.
In case of Edit Modal:
https://filamentphp.com/docs/3.x/actions/prebuilt-actions/edit#lifecycle-hooks
In case of Edit Page:...
4 Replies
Solution
Here, lifecycle hooks should be the means of handling the thing.
In case of Edit Modal:
https://filamentphp.com/docs/3.x/actions/prebuilt-actions/edit#lifecycle-hooks
In case of Edit Page:
https://filamentphp.com/docs/3.x/panels/resources/editing-records#lifecycle-hooks
Maybe like this?
Totally overlooked / misunderstood that, thank you!
I've quickly tried the below, with no luck... Am I putting this in the right place within the action?
Remove the after() method and insert the afterSave() method as described above.
Nice! Thank you.
Sorry, I missed the resources link in your first message, which would have detailed everything for me.
Working perfectly.... Thanks again.