-
Notifications
You must be signed in to change notification settings - Fork 76
Description
Not sure if I'm doing something wrong or if this is a bug or intentional...
But when I call $model->save() on a model that uses the ValidatingTrait, the eloquent.validating event is fired before validation, which allows for some cleanup, setting of default properties, etc.
However, if I just call $model->isValid(), the eloquent.validating event does not seem to be triggered, so validation fails (when it would have succeeded in the context of saving).
Being able to call isValid() without saving would be particularly useful in tests, since there's no need to hit the database.
From looking at the code, it appears that both ValidatingTrait and ValidatingObserver have methods called performValidation(). The ValidatingObserver one invokes the events, while the trait one doesn't.
Any idea how to fix this?