How to `->getOriginal()` from Model in `afterSave()` hook?
I need the original state of the model and I don't want to use observers
6 Replies
Just out of curiosity - what do you need the original state for? Maybe you could grab some of this original data in the
beforeSave()
hook.Yes, it's work in
beforeSave
I need to create an action log and as I said, I don't want to use observersAny particular reason for not using observers? It’s kinda what they were designed for. You’d also loose the functionality should you ever use something other than Filament.
Yes. Observers do not work with mass updates. I need to create an event and a listener to handle mass updates, so my logging logic must be in different places. It's not convenient that's why I want to control my logging action from "controllers". Also, it's useful with filament actions that not change model
Fair enough. Was just curious. Thank you for the response.
In afterSave(), $this->oldFormState should contain all the state paths which have been changed.