Illuminate\Support\Collection::sortByDesc PHP Method

sortByDesc() public method

Sort the collection in descending order using the given callback.
public sortByDesc ( callable | string $callback, integer $options = SORT_REGULAR ) : static
$callback callable | string
$options integer
return static
    public function sortByDesc($callback, $options = SORT_REGULAR)
    {
        return $this->sortBy($callback, $options, true);
    }

Usage Example

Example #1
0
 /**
  * @return Collection
  */
 public function getCategories()
 {
     $set = $this->categories->sortByDesc(function (CategoryModel $category) {
         return $category->spent;
     });
     return $set;
 }
All Usage Examples Of Illuminate\Support\Collection::sortByDesc