Overtrue\Validation\Validator::passesOptionalCheck PHP Method

passesOptionalCheck() protected method

Determine if the attribute passes any optional check.
protected passesOptionalCheck ( string $attribute ) : boolean
$attribute string
return boolean
    protected function passesOptionalCheck($attribute)
    {
        if ($this->hasRule($attribute, ['Sometimes'])) {
            return array_key_exists($attribute, array_dot($this->data)) || array_key_exists($attribute, $this->files);
        }
        return true;
    }
Validator