Skip to content

Commit

Permalink
revert broken pr
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Aug 29, 2016
1 parent 4046a81 commit b1299d1
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions src/Illuminate/Database/Eloquent/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -388,26 +388,21 @@ public function chunk($count, callable $callback)
*
* @param int $count
* @param callable $callback
* @param string $column
* @param string $alias
* @return bool
*/
public function chunkById($count, callable $callback, $column = null, $alias = null)
public function chunkById($count, callable $callback, $column = 'id')
{
$lastId = null;

$column = is_null($column) ? $this->getModel()->getKeyName() : null;

$alias = is_null($alias) ? $column : $alias;

$results = $this->forPageAfterId($count, 0, $column)->get();

while (! $results->isEmpty()) {
if (call_user_func($callback, $results) === false) {
return false;
}

$lastId = $results->last()->{$alias};
$lastId = $results->last()->{$column};

$results = $this->forPageAfterId($count, $lastId, $column)->get();
}
Expand Down

0 comments on commit b1299d1

Please sign in to comment.