protected function generateModelInstances($query, $totalCount)
    {
        $chunkSize = $this->getChunkSize();

        $chunkCount = ceil($totalCount / $chunkSize);

        for ($x = 0; $x < $chunkCount; $x++) {

            $skip = $x * $chunkSize;

            yield $query
                ->skip($skip)
                ->take($chunkSize)
                ->get();
        }
    }
protected function generateModelInstances($query, $totalCount)
    {
        $chunkSize = $this->getChunkSize();

        $chunkCount = ceil($totalCount / $chunkSize);

        for ($x = 0; $x < $chunkCount; $x++) {

            $skip = $x * $chunkSize;

            yield $query
                ->skip($skip)
                ->take($chunkSize)
                ->get();
        }
    }
protected function generateModelInstances ( $ query , $ totalCount ) { $ chunkSize = $ this -> getChunkSize ( ) ; $ chunkCount = ceil ( $ totalCount / $ chunkSize ) ; for ( $ x = 0 ; $ x < $ chunkCount ; $ x ++ ) { $ skip = $ x * $ chunkSize ; yield $ query -> skip ( $ skip ) -> take ( $ chunkSize ) -> get ( ) ; } }
Sets up and returns generator for model instances.

This also starts the progress bar, given the total count of matched

@param Builder $query
@param int     $totalCount
@return \Generator
Sets up and returns generator for model instances .