accessing create functions inside a custom filament page
How can I access(use) resource create functions such as mutateFormDataBeforeCreate and afterCreate
Solution:Jump to solution
If it's a custom page there is no
afterCreate()
etc. because you have full control over the form. You need to implement the save logic yourself6 Replies
I don't understand your question
I needed a create page on the navbar, so I created a new custom page, and copy pasted the from in resourceA, in the resource A, I had some lifecycle hooks functions on the CreatePage of resource A such as afterCreate() which updated the value of another field with the created field
Solution
If it's a custom page there is no
afterCreate()
etc. because you have full control over the form. You need to implement the save logic yourselfso, I've got this function, it's succesfully saved but when updating the $new_qty nothing happens, I needed it to decrement the 'qty' with $new
Did you debug
$saleStores
?
Why should there be SalesStores when you just created that Sale? Is that via an Observer?the salesStores is a pivot table between sales and store, when I dd it returns an empty array 😅
yep, this is it, just solved it after moving
before the foreach loop
Many thanks!