Try this:
Student::with(array('exam' => function($query) {
$query->orderBy('result', 'DESC');
}))
->get();
More Related Contents:
- Migration: Cannot add foreign key constraint
- Laravel Eloquent groupBy() AND also return count of each group
- Eloquent Collection: Counting and Detect Empty
- Laravel. Use scope() in models with relation
- Laravel Eloquent “WHERE NOT IN”
- How to access model hasMany Relation with where condition?
- Eloquent push() and save() difference
- Laravel save / update many to many relationship
- First Or Create
- Laravel: Returning the namespaced owner of a polymorphic relation
- Polymorphic Eloquent relationships with namespaces
- Clone an Eloquent object including all relationships?
- Laravel redirect back to original destination after login
- How to select from subquery using Laravel Query Builder?
- How can I resolve “Your requirements could not be resolved to an installable set of packages” error?
- Laravel Redirect Back with() Message
- How can I remove a package from Laravel using PHP Composer?
- Laravel 4: how to run a raw SQL?
- Laravel 4: how to “order by” using Eloquent ORM [duplicate]
- HasManyThrough with one-to-many relationship
- Laravel Migration Change to Make a Column Nullable
- Laravel Controller Subfolder routing
- Update without touching timestamps (Laravel)
- Validation of array form fields in laravel 4 error
- Best Practices for Laravel 4 Helpers and Basic Functions?
- Find or Create with Eloquent
- Laravel: Change base URL?
- How to setup conditional relationship on Eloquent
- Laravel Eloquent – Where In All
- Laravel 4 : Route to localhost/controller/action