O'Reilly logo
  • GIL EG thinks this is interesting:

\App\Book::chunk(200, function($books) { foreach ($books as $book) { // heavy operations on the book here... } });

From

Cover of Learning Laravel's Eloquent

Note

Records chunking for memory optimization