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

whereSub() protected method

Add a full sub-select to the query.
protected whereSub ( string $column, string $operator, Closure $callback, string $boolean )
$column string
$operator string
$callback Closure
$boolean string
    protected function whereSub($column, $operator, Closure $callback, $boolean)
    {
        $type = 'Sub';
        $query = $this->newQuery();
        // Once we have the query instance we can simply execute it so it can add all
        // of the sub-select's conditions to itself, and then we can cache it off
        // in the array of where clauses for the "main" parent query instance.
        call_user_func($callback, $query);
        $this->wheres[] = compact('type', 'column', 'operator', 'query', 'boolean');
        $this->addBinding($query->getBindings(), 'where');
        return $this;
    }