src/Paging/CursorQueryBuilder.php
protected function getFakeModelQuery($wrappedQuery)
    {
        /**
         * Clone of original Eloquent model, which we can modify to apply some hacks to build specific query
         *
         * @var Model $fakeModel
         */
        $fakeModel = new $this->model;
        $fakeModel->setTable(DB::raw("(" . $wrappedQuery->toSql() . ") AS " . $this->model->getTable()));

        /**
         * Query builder
         *
         * @var EloquentBuilder $modelQuery
         */
        $modelQuery = $fakeModel->newQueryWithoutScopes();
        $builder = Query::getBaseQuery($modelQuery);
        $builder->columns = null; // We always select everything from subquery
        $modelQuery->setQuery($builder->cloneWithoutBindings(['select', 'where'])); // remove default bindings
        $modelQuery->mergeBindings($wrappedQuery);
        return $modelQuery;
    }
protected function getFakeModelQuery($wrappedQuery)
    {
        /**
         * Clone of original Eloquent model, which we can modify to apply some hacks to build specific query
         *
         * @var Model $fakeModel
         */
        $fakeModel = new $this->model;
        $fakeModel->setTable(DB::raw("(" . $wrappedQuery->toSql() . ") AS " . $this->model->getTable()));

        /**
         * Query builder
         *
         * @var EloquentBuilder $modelQuery
         */
        $modelQuery = $fakeModel->newQueryWithoutScopes();
        $builder = Query::getBaseQuery($modelQuery);
        $builder->columns = null; // We always select everything from subquery
        $modelQuery->setQuery($builder->cloneWithoutBindings(['select', 'where'])); // remove default bindings
        $modelQuery->mergeBindings($wrappedQuery);
        return $modelQuery;
    }
Buld query around model clone without scopes, that may affect query result.

@param QueryBuilder $wrappedQuery Query to actually perform
@return EloquentBuilder|QueryBuilder