Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: illuminate/collections
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v10.47.0
Choose a base ref
...
head repository: illuminate/collections
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v10.48.0
Choose a head ref
  • 1 commit
  • 1 file changed
  • 2 contributors

Commits on Mar 10, 2024

  1. [10.x] Fix for sortByDesc ignoring multiple attributes (#50431)

    * Failing Test
    
    * Fix for sortByDesc
    
    * Update Collection.php
    
    ---------
    
    Co-authored-by: Taylor Otwell <taylor@laravel.com>
    TWithers and taylorotwell authored Mar 10, 2024
    Copy the full SHA
    3665152 View commit details
Showing with 10 additions and 0 deletions.
  1. +10 −0 Collection.php
10 changes: 10 additions & 0 deletions Collection.php
Original file line number Diff line number Diff line change
@@ -1490,6 +1490,16 @@ protected function sortByMany(array $comparisons = [], int $options = SORT_REGUL
*/
public function sortByDesc($callback, $options = SORT_REGULAR)
{
if (is_array($callback) && ! is_callable($callback)) {
foreach ($callback as $index => $key) {
$comparison = Arr::wrap($key);

$comparison[1] = 'desc';

$callback[$index] = $comparison;
}
}

return $this->sortBy($callback, $options, true);
}