Laravel chunk returns null
问题 I'm needing to chunk my query as it's making PHP run out of memory, however the below code just dumps null : $chunked = $query->chunk(25, function ($events) { //dd($events); }); dd($chunked); However, when I do the below, it dumps the first chunk of 25: $chunked = $query->chunk(25, function ($events) { dd($events); }); //dd($chunked); No combination of changing dd($events); to the likes of return $events , return true , iterating over each item in each chunk and returning that - works. Am I