1$collection = collect([
2 ['name' => 'Desk', 'price' => 200],
3 ['name' => 'Chair', 'price' => 100],
4 ['name' => 'Bookcase', 'price' => 150],
5]);
6
7$sorted = $collection->sortBy('price');
8
9$sorted->values()->all();
10
11/*
12 [
13 ['name' => 'Chair', 'price' => 100],
14 ['name' => 'Bookcase', 'price' => 150],
15 ['name' => 'Desk', 'price' => 200],
16 ]
17*/