protected function performValidation(Model $model, $event)
{
// If the model has validating enabled, perform it.
if ($model->getValidating()) {
// Fire the namespaced validating event and prevent validation
// if it returns a value.
if ($this->fireValidatingEvent($model, $event) !== null) {
return;
}
// Fire the validating failed event.
if ($model->isValid($event) === false) {
$this->fireValidatedEvent($model, 'failed');
if ($model->getThrowValidationExceptions()) {
$model->throwValidationException();
}
return false;
}
// Fire the validating.passed event.
$this->fireValidatedEvent($model, 'passed');
// Fire the validating.skipped event.
} else {
$this->fireValidatedEvent($model, 'skipped');
}
}