public function validate(Model $model, $data) { // First validate the base if (!parent::validate($model, $data)) { return false; } if (isset($data) && isset($this->childProperty)) { $okay = true; foreach ($data as $v) { if (!$this->childProperty->validate($model, $v)) { $okay = false; } } return $okay; } else { return true; } }
public function validate(Model $model, $data) { // First validate the base if (!parent::validate($model, $data)) { return false; } if (isset($data)) { return $this->model->validate($data); } else { return true; } }