You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've added this to the docs. Is it what you're after?
To add model validation for introduced fields, hook into the beforeValidate event and throw a ValidationException exception.
User::extend(function ($model) {
$model->bindEvent('model.beforeValidate', function () use ($model) {
if (!$model->billing_first_name) {
throw new \ValidationException(['billing_first_name' => 'First name is required']);
}
});
});
There is a lack of information on how to validate the added fields to the model. Is this implemented using the
addDinamycProperty()
method?The text was updated successfully, but these errors were encountered: