I\'m new to laravel (switched from CI) and eloquent ORM is still a bit of a mystery at some point!
Here is my problem :
I\'d like to sort data from my db usi
I had the same problem before but it was a one-to-one relationship. This post helped me. I ended up using a join. My code was like this:
$data = Posts::join('comments', 'comments.post_id', '=', 'posts.id')
->order_by('comments.created_at')
->get(array('comments.field1 as field1', 'posts.field2 as field2'));