This commit is contained in:
2021-12-02 16:29:54 +08:00
parent 4ac84b3edf
commit b80833691e
+1 -4
View File
@@ -20,10 +20,7 @@ class RequiredValidator extends BaseValidator
public function trigger(): bool public function trigger(): bool
{ {
$param = $this->getParams(); $param = $this->getParams();
if (is_numeric($param)) { if (!is_array($param) || !isset($param[$this->field])) {
return true;
}
if (empty($param) || !isset($param[$this->field])) {
return $this->addError('The param :attribute not exists'); return $this->addError('The param :attribute not exists');
} else { } else {
return true; return true;