This commit is contained in:
2022-09-17 19:28:53 +08:00
parent 60cd694671
commit c8194f3089
+2 -2
View File
@@ -20,10 +20,10 @@ class UniqueValidator extends BaseValidator
*/ */
public function trigger(): bool public function trigger(): bool
{ {
if (empty($model)) { if (empty($this->model)) {
return $this->addError('model','Model error.'); return $this->addError('model','Model error.');
} }
if (!$model->getIsNowExample()) { if (!$this->model->getIsNowExample()) {
return true; return true;
} }
return $this->_validator($this->field, function ($field, $params, $model) { return $this->_validator($this->field, function ($field, $params, $model) {