src/Jedrzej/Searchable/Constraint.php
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);
        }
    }
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);
        }
    }
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 ) ; } }
Applies non-relation constraint to query.

@param Builder $builder query builder
@param string $field field name
@param string $mode determines how constraint is added to existing query ("or" or "and")
Applies non - relation constraint to query .