protected function doApply(Builder $builder, $field, $mode = Constraint::MODE_AND)
    {
        if ($this->operator == Constraint::OPERATOR_IN) {
            $method = $mode != static::MODE_OR ? 'whereIn' : 'orWhereIn';
            $builder->$method($field, $this->value);
        } elseif ($this->operator == Constraint::OPERATOR_NOT_IN) {
            $method = $mode != static::MODE_OR ? 'whereNotIn' : 'orWhereNotIn';
            $builder->$method($field, $this->value);
        } elseif ($this->operator == Constraint::OPERATOR_NOT_NULL) {
            $method = $mode != static::MODE_OR ? 'whereNotNull' : 'orWhereNotNull';
            $builder->$method($field);
        } elseif ($this->operator == Constraint::OPERATOR_NULL) {
            $method = $mode != static::MODE_OR ? 'whereNull' : 'orWhereNull';
            $builder->$method($field);
        } else {
            $method = $mode != static::MODE_OR ? 'where' : 'orWhere';
            $builder->$method($field, $this->operator, $this->value);
        }
    }