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

whereNested() public method

Add a nested where statement to the query.
public whereNested ( Closure $callback, string $boolean = 'and' ) : Builder | static
$callback Closure
$boolean string
return Builder | static
    public function whereNested(Closure $callback, $boolean = 'and')
    {
        $query = $this->forNestedWhere();
        call_user_func($callback, $query);
        return $this->addNestedWhereQuery($query, $boolean);
    }

Usage Example

Exemplo n.º 1
0
 /**
  * {@inheritdoc}
  */
 public function applyFilterConstraint(Builder $query, $data)
 {
     if ($this->multiple or !($data = $this->parse($data))) {
         return;
     }
     $query->whereNested(function ($inner) use($data) {
         foreach ($data as $key) {
             $inner->orWhere($this->id, '=', $key);
         }
     });
 }
All Usage Examples Of Illuminate\Database\Query\Builder::whereNested