Replies: 1 comment
-
I know this is really old, but came across it while looking for an answer to another problem I had, and thought I'd share my solution for this one. I added a custom field called "originalForHooks" in my model, and fill it in in the @beforeSave()
public static async setPublishedAt(ad: PartAd) {
// Store the original values in a custom property
ad.originalForHooks = { ...ad.$original };
// ...
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Is it possible to get the previous state of the model (like the
$original
property) in the after hook (like@afterSave
)? I could not find anything like that.Any guidance would be much appreciated.
Beta Was this translation helpful? Give feedback.
All reactions