This commit is contained in:
2023-04-21 23:09:35 +08:00
parent 232d0535f5
commit 726742f66f
+2 -2
View File
@@ -25,8 +25,8 @@ class LengthValidator extends BaseValidator
*/
public function trigger(): bool
{
return $this->_validator($this->field, function ($field, $params, $method, $value) {
$value = $params[$this->field] ?? null;
return $this->_validator($this->field, function ($field, $params, $method, $length) {
$value = $params[$field] ?? null;
if (empty($value)) {
if ($method != self::MAX_LENGTH) {
return $this->addError($field, 'The param :attribute not exists');