src/QueryBuilder/QueryBuilder.php
protected function initializeFromBuilder(Builder $builder)
    {
        $this->builder->setModel($builder->getModel())
            ->setEagerLoads($builder->getEagerLoads());

        $this->baseTable = $this->builder->getModel()->getTable();
        $this->baseModel = $this->builder->getModel();
        $this->modelClass = get_class($this->builder->getModel());

        $this->joinResolver = new JoinResolver($this);
    }
protected function initializeFromBuilder(Builder $builder)
    {
        $this->builder->setModel($builder->getModel())
            ->setEagerLoads($builder->getEagerLoads());

        $this->baseTable = $this->builder->getModel()->getTable();
        $this->baseModel = $this->builder->getModel();
        $this->modelClass = get_class($this->builder->getModel());

        $this->joinResolver = new JoinResolver($this);
    }
Add the model, scopes, eager loaded relationships, local macro's and onDelete callback
from the $builder to this query builder.

@param \Illuminate\Database\Eloquent\Builder $builder