public function invalidate($field, $errors = [])
    {
        $schema = $this->schema();

        if (func_num_args() === 1) {
            foreach ($field as $key => $value) {
                if ($schema->hasRelation($key) && $this->has($key)) {
                    $this->{$key}->invalidate($value);
                } else {
                    $this->invalidate($key, $value);
                }
            }
            return $this;
        }
        if ($errors) {
            $this->_errors[$field] = (array) $errors;
        }
        return $this;
    }
public function invalidate($field, $errors = [])
    {
        $schema = $this->schema();

        if (func_num_args() === 1) {
            foreach ($field as $key => $value) {
                if ($schema->hasRelation($key) && $this->has($key)) {
                    $this->{$key}->invalidate($value);
                } else {
                    $this->invalidate($key, $value);
                }
            }
            return $this;
        }
        if ($errors) {
            $this->_errors[$field] = (array) $errors;
        }
        return $this;
    }
public function invalidate ( $ field , $ errors = [ ] ) { $ schema = $ this -> schema ( ) ; if ( func_num_args ( ) === 1 ) { foreach ( $ field as $ key => $ value ) { if ( $ schema -> hasRelation ( $ key ) && $ this -> has ( $ key ) ) { $ this -> { $ key } -> invalidate ( $ value ) ; } else { $ this -> invalidate ( $ key , $ value ) ; } } return $ this ; } if ( $ errors ) { $ this -> _errors [ $ field ] = ( array ) $ errors ; } return $ this ; }
Invalidate a field or an array of fields.

@param  string|array $field  The field to invalidate of an array of fields with associated errors.
@param  string|array $errors The associated error message(s).
@return self
Invalidate a field or an array of fields .