modify plugin name
This commit is contained in:
+9
-2
@@ -20,8 +20,15 @@ class EnumValidator extends BaseValidator
|
|||||||
public function trigger(): bool
|
public function trigger(): bool
|
||||||
{
|
{
|
||||||
return $this->_validator($this->field, function ($field, $params, $values) {
|
return $this->_validator($this->field, function ($field, $params, $values) {
|
||||||
if (!in_array($params[$field] ?? null, $values)) {
|
$value = $params[$field] ?? null;
|
||||||
$message = 'The param :attribute value(' . $params[$field] . ') only in ' . implode(',', $values);
|
if (is_null($value)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if ($value === '') {
|
||||||
|
return $this->addError($field, 'The param :attribute value con\'t empty.');
|
||||||
|
}
|
||||||
|
if (!in_array($value, $values)) {
|
||||||
|
$message = 'The param :attribute value(' . $value . ') only in ' . implode(',', $values);
|
||||||
return $this->addError($field, $message);
|
return $this->addError($field, $message);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
Reference in New Issue
Block a user