In each model that you want to observe you can write a afterFind()
method, where you store the current DB attributes into some private variable, e.b. _dbValues
. Then in beforeSave()
you verify the current attributes with the ones in _dbValues
and create an audit record if there was a change.
After you have this working, you can take it a step further and create a behavior from it. You'd put the private variable, the afterFind()
and the beforeSave()
method there. Then you can attach that behavior to many records.