Skip to content

Commit

Permalink
fix chunkByIdDesc
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Apr 10, 2024
1 parent b905597 commit db3fe1b
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/Illuminate/Database/Eloquent/Relations/HasManyThrough.php
Expand Up @@ -600,6 +600,24 @@ public function chunkById($count, callable $callback, $column = null, $alias = n
return $this->prepareQueryBuilder()->chunkById($count, $callback, $column, $alias);
}

/**
* Chunk the results of a query by comparing IDs in descending order.
*
* @param int $count
* @param callable $callback
* @param string|null $column
* @param string|null $alias
* @return bool
*/
public function chunkByIdDesc($count, callable $callback, $column = null, $alias = null)
{
$column ??= $this->getRelated()->getQualifiedKeyName();

$alias ??= $this->getRelated()->getKeyName();

return $this->prepareQueryBuilder()->chunkByIdDesc($count, $callback, $column, $alias);
}

/**
* Execute a callback over each item while chunking by ID.
*
Expand Down

1 comment on commit db3fe1b

@GromNaN
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Follow-up #50991

Please sign in to comment.