I need to sort posts by highest id :/. Currently, the code sorts them by the lowest ID.
$posts->sortBy('id');
How can I do that?
Advertisement
Answer
$posts->sortByDesc('id');
Source: Laravel Collections
I need to sort posts by highest id :/. Currently, the code sorts them by the lowest ID.
$posts->sortBy('id');
How can I do that?
$posts->sortByDesc('id');
Source: Laravel Collections