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 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;
 }
Exemplo n.º 2
-1
 /**
  * Add a raw or where clause to the query.
  *
  * @param string $sql
  * @param array $bindings
  * @return \Illuminate\Database\Query\Builder|static 
  * @static 
  */
 public static function orWhereRaw($sql, $bindings = array())
 {
     return \Illuminate\Database\Query\Builder::orWhereRaw($sql, $bindings);
 }