This commit is contained in:
2021-10-09 16:48:19 +08:00
parent 2c6d216953
commit 97c07dabeb
2 changed files with 5 additions and 5 deletions
+1 -1
View File
@@ -33,7 +33,7 @@ class UniqueValidator extends BaseValidator
if (!$this->model->getIsCreate()) {
return true;
}
if ($model::find()->where([$this->field => $param[$this->field]])->exists()) {
if ($model::query()->where([$this->field => $param[$this->field]])->exists()) {
return $this->addError('The :attribute \'' . $param[$this->field] . '\' is exists!');
}
return $this->isFail = TRUE;