Reputation: 710
I have a model and I check for some validations before create and update. In many instances, it applies to both beforeCreate and beforeUpdate. Is there a better way to merge these two functions, something like before_save in rails?
Upvotes: 0
Views: 269
Reputation: 5979
Yes, you can define beforeValidate or afterValidate which will run on both save and create.
Upvotes: 2