O'Reilly logo
  • GIL EG thinks this is interesting:

 $authors = \App\Author::with(['books' => function($query)
  {
    $query->orderBy('year', 'asc');

  }])->get()

From

Cover of Learning Laravel's Eloquent

Note

advanced eager loading, related models with conditional clause