There are a several different ways of sorting a collection.
Sort()
The sort method sorts the collection:
$collection = collect([5, 3, 1, 2, 4]);
$sorted = $collection->sort();
echo $sorted->values()->all();
returns : [1, 2, 3, 4, 5]
The sort method also allows for passing in ...