Skip to content

Commit

Permalink
clone query for chunking
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Dec 7, 2016
1 parent 23f5a4c commit 53f97a0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Illuminate/Database/Query/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -1847,7 +1847,9 @@ public function chunkById($count, callable $callback, $column = 'id', $alias = n
$lastId = 0;

do {
$results = $this->forPageAfterId($count, $lastId, $column)->get();
$clone = clone $this;

$results = $clone->forPageAfterId($count, $lastId, $column)->get();

$countResults = $results->count();

Expand Down

0 comments on commit 53f97a0

Please sign in to comment.