Illuminate\Database\Eloquent\Builder::nestWheresForScope PHP Method

nestWheresForScope() protected method

Nest where conditions by slicing them at the given where count.
protected nestWheresForScope ( Builder $query, integer $originalWhereCount ) : void
$query Illuminate\Database\Query\Builder
$originalWhereCount integer
return void
    protected function nestWheresForScope(QueryBuilder $query, $originalWhereCount)
    {
        // Here, we totally remove all of the where clauses since we are going to
        // rebuild them as nested queries by slicing the groups of wheres into
        // their own sections. This is to prevent any confusing logic order.
        $allWheres = $query->wheres;
        $query->wheres = [];
        $this->addNestedWhereSlice($query, $allWheres, 0, $originalWhereCount);
        $this->addNestedWhereSlice($query, $allWheres, $originalWhereCount);
    }