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?
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?
For sorting by highest id use orderBy in Laravel, for example if you want to sort all your projects:
$projects = Project::orderBy('id', 'desc')->get();