Skip to content

Commit db3fe1b

Browse files
committed
fix chunkByIdDesc
1 parent b905597 commit db3fe1b

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

src/Illuminate/Database/Eloquent/Relations/HasManyThrough.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -600,6 +600,24 @@ public function chunkById($count, callable $callback, $column = null, $alias = n
600600
return $this->prepareQueryBuilder()->chunkById($count, $callback, $column, $alias);
601601
}
602602

603+
/**
604+
* Chunk the results of a query by comparing IDs in descending order.
605+
*
606+
* @param int $count
607+
* @param callable $callback
608+
* @param string|null $column
609+
* @param string|null $alias
610+
* @return bool
611+
*/
612+
public function chunkByIdDesc($count, callable $callback, $column = null, $alias = null)
613+
{
614+
$column ??= $this->getRelated()->getQualifiedKeyName();
615+
616+
$alias ??= $this->getRelated()->getKeyName();
617+
618+
return $this->prepareQueryBuilder()->chunkByIdDesc($count, $callback, $column, $alias);
619+
}
620+
603621
/**
604622
* Execute a callback over each item while chunking by ID.
605623
*

0 commit comments

Comments
 (0)