src/Gzero/Cms/Repositories/BlockReadRepository.php
public function getManyFiles(Block $block, QueryBuilder $builder): LengthAwarePaginator
    {
        $query = $block->files(false)->with(['type','translations']);

        $count = clone $query->getQuery();

        $results = $query->limit($builder->getPageSize())
            ->offset($builder->getPageSize() * ($builder->getPage() - 1))
            ->get(['files.*']);

        return new LengthAwarePaginator(
            $results,
            $count->select('files.id')->get()->count(),
            $builder->getPageSize(),
            $builder->getPage()
        );
    }
public function getManyFiles(Block $block, QueryBuilder $builder): LengthAwarePaginator
    {
        $query = $block->files(false)->with(['type','translations']);

        $count = clone $query->getQuery();

        $results = $query->limit($builder->getPageSize())
            ->offset($builder->getPageSize() * ($builder->getPage() - 1))
            ->get(['files.*']);

        return new LengthAwarePaginator(
            $results,
            $count->select('files.id')->get()->count(),
            $builder->getPageSize(),
            $builder->getPage()
        );
    }
public function getManyFiles ( Block $ block , QueryBuilder $ builder ) : LengthAwarePaginator { $ query = $ block -> files ( false ) -> with ( [ 'type' , 'translations' ] ) ; $ count = clone $ query -> getQuery ( ) ; $ results = $ query -> limit ( $ builder -> getPageSize ( ) ) -> offset ( $ builder -> getPageSize ( ) * ( $ builder -> getPage ( ) - 1 ) ) -> get ( [ 'files.*' ] ) ; return new LengthAwarePaginator ( $ results , $ count -> select ( 'files.id' ) -> get ( ) -> count ( ) , $ builder -> getPageSize ( ) , $ builder -> getPage ( ) ) ; }
Get all files with translations for specified block.

@param Block        $block   Block model
@param QueryBuilder $builder Query builder

@return Collection|LengthAwarePaginator
Get all files with translations for specified block .