Hello, this is the progress that I have taken so far, I have managed to join and group the data but I am missing that data to show me the groups from largest to smallest, could someone help me or guide me on how to do it?
DB::table('scores')
->leftJoin('likes', 'scores.id', '=', 'likes.score_id')
->get()
->groupBy('score_id')
Result: (I join and group the data but now i need to show it from the grup that have more to less in this case first the one that have 8 and then the other 4 )
Illuminate\Support\Collection {#1479 ▼
#items: array:2 [▼
4 => Illuminate\Support\Collection {#1561 ▼
#items: array:4 [▼
0 => {#1552 ▶}
1 => {#1503 ▶}
2 => {#1588 ▶}
3 => {#1500 ▶}
]
}
1 => Illuminate\Support\Collection {#1538 ▼
#items: array:8 [▼
0 => {#1564 ▶}
1 => {#1486 ▶}
2 => {#1581 ▶}
3 => {#1579 ▶}
4 => {#1562 ▶}
5 => {#1573 ▶}
6 => {#1574 ▶}
7 => {#1575 ▶}
]
}
]
}