Laravel 内置的一些验证规则

in 前端 with 0 comment

required

filled

 if (Arr::has($this->data, $attribute)) {
     return $this->validateRequired($attribute, $value);
 }

nullable

public function validateNullable()
{
   return true;
}

present

public function validatePresent($attribute, $value)
{
    return Arr::has($this->data, $attribute);
}
Comments are closed.