Illuminate\Database\Query\Builder::orWhereRaw PHP Method

orWhereRaw() public method

Add a raw or where clause to the query.
public orWhereRaw ( string $sql, array $bindings = [] ) : Builder | static
$sql string
$bindings array
return Builder | static
    public function orWhereRaw($sql, array $bindings = [])
    {
        return $this->whereRaw($sql, $bindings, 'or');
    }

Usage Example

 public function fetchSelectedItems(QueryBuilder $builder)
 {
     $self = $this;
     $this->filters->items[] = -1;
     //faço a busca de acordo com a palavra pesquisada, caso tenha uma:
     if ($this->filters->searchString) {
         if (count($this->filters->columns) > 0) {
             $builder->where(function ($q) use($self, $builder) {
                 foreach ($this->filters->columns as $column) {
                     if (!$column->bSearchable) {
                         continue;
                     }
                     $builder->orWhereRaw($column->name . " LIKE '%" . $self->filters->searchString . "%'");
                 }
             });
         }
     }
     if ($this->filters->checkedAll == 1) {
         $builder->whereNotIn($this->filters->idField, $this->filters->items);
         return $builder;
     }
     $builder->whereIn($this->filters->idField, $this->filters->items);
     return $builder;
 }
All Usage Examples Of Illuminate\Database\Query\Builder::orWhereRaw