protected function getWithBuilder(
        array $with,
        ?array $withCounts = null,
        ?array $where = null,
        ?SortOptions $sortOptions = null
    ): Builder {
        return $this->query()
            ->when($with, function (Builder $query) use ($with) {
                return $query->with($with);
            })
            ->when($withCounts, function (Builder $query) use ($withCounts) {
                return $query->withCount($withCounts);
            })
            ->when($where, function (Builder $query) use ($where) {
                return $query->where($where);
            })
            ->when($sortOptions, function (Builder $query) use ($sortOptions) {
                return $query->orderBy($sortOptions->orderBy, $sortOptions->sortOrder);
            });
    }
protected function getWithBuilder(
        array $with,
        ?array $withCounts = null,
        ?array $where = null,
        ?SortOptions $sortOptions = null
    ): Builder {
        return $this->query()
            ->when($with, function (Builder $query) use ($with) {
                return $query->with($with);
            })
            ->when($withCounts, function (Builder $query) use ($withCounts) {
                return $query->withCount($withCounts);
            })
            ->when($where, function (Builder $query) use ($where) {
                return $query->where($where);
            })
            ->when($sortOptions, function (Builder $query) use ($sortOptions) {
                return $query->orderBy($sortOptions->orderBy, $sortOptions->sortOrder);
            });
    }
protected function getWithBuilder ( array $ with , ? array $ withCounts = null , ? array $ where = null , ? SortOptions $ sortOptions = null ) : Builder { return $ this -> query ( ) -> when ( $ with , function ( Builder $ query ) use ( $ with ) { return $ query -> with ( $ with ) ; } ) -> when ( $ withCounts , function ( Builder $ query ) use ( $ withCounts ) { return $ query -> withCount ( $ withCounts ) ; } ) -> when ( $ where , function ( Builder $ query ) use ( $ where ) { return $ query -> where ( $ where ) ; } ) -> when ( $ sortOptions , function ( Builder $ query ) use ( $ sortOptions ) { return $ query -> orderBy ( $ sortOptions -> orderBy , $ sortOptions -> sortOrder ) ; } ) ; }
Returns builder that satisfied requested conditions, with eager loaded requested relations and relations counts,
ordered by requested rules.

@param array $with Which relations should be preloaded
@param array|null $withCounts Which related entities should be counted
@param array|null $where Conditions that retrieved entities should satisfy
@param SortOptions|null $sortOptions How list of item should be sorted

@return Builder

@deprecated This method unnecessary anymore and will be removed in next version
Returns builder that satisfied requested conditions with eager loaded requested relations and relations counts ordered by requested rules .