how to update another model instead of updating current resource?
hello i want to insert data into another model first when user edit a form.
what should i do?
7 Replies
how to tell this function don't update any field?
Maybe use Eloquent observers with updating() method (not updated()) that would execute before the update.
sorry, what does it mean?
I recommend handle this in the Model level.
You may use an Eloquent observer and the
updating
/updated
method.
You also can check weather specific field has been updated by using wasChanged
.
Note: The updating
/updated
methods will not called at all when no fields has been changed.I suppose you could do something like this on your EditXXX class: (perhaps wrap it in a db transaction)
mamnun 😃 🤝
thanks for your help
thanks for replying. problem solved
thanks