Laravel 4: how to “order by” using Eloquent ORM [duplicate]

Simple question – how do I order by ‘id’ descending in Laravel 4.

The relevant part of my controller looks like this:

$posts = $this->post->all()

As I understand you use this line:

->orderBy('id', 'DESC');

But how does that fit in with my above code?

3 Answers
3

Leave a Comment