I want to stop the query chunk loop, is there a way to do that? My code
$limit = 1000;
$total = 0;
$query->chunkById(
100,
function ($items) {
foreach ($items as $item) {
// do something
if ($total >= $limit) {
// how to stop?
}
$total++;
}
}
);
I already followed many solutions i found in many sites but still not working.
2
Answers
I found the solution to my problem, just return false in the loop
How about the following the code?