👷♂️
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* This gist is offered as is, make sure to test in your environment | |
* | |
* This class can be used to iterate over a large Eloquent query. It uses a combination of the PDO Fetch and | |
* the chunk methods to collect a series of items in memory. The chunk part was necessary in order to implement | |
* eager loading options. You can set the CHUNK_SIZE in the code to set how many rows to load in memory at a time | |
* again for the eager loading purposes. | |
* | |
* I am sure there are other ways to implement this technique more effectively |