Simply invoke orderBy()
as many times as you need it. For instance:
User::orderBy('name', 'DESC')
->orderBy('email', 'ASC')
->get();
Produces the following query:
SELECT * FROM `users` ORDER BY `name` DESC, `email` ASC
More Related Contents:
- How to Create Multiple Where Clause Query Using Laravel Eloquent?
- Get Specific Columns Using “With()” Function in Laravel Eloquent
- How do I get the query builder to output its raw SQL query as a string?
- Laravel Eloquent Query Using WHERE with OR AND OR?
- Creating and Update Laravel Eloquent
- Get the Query Executed in Laravel 3/4
- Property Property Property [title] does not exist on this collection instance does not exist on this collection instance does not exist on this collection instance
- Automatically deleting related rows in Laravel (Eloquent ORM)
- Get the Last Inserted Id Using Laravel Eloquent
- How to do this in Laravel, subquery where in
- How to insert multiple rows from a single query using eloquent/fluent
- Laravel – Eloquent or Fluent random row
- Laravel update model with unique validation rule for attribute
- Add a custom attribute to a Laravel / Eloquent model on load?
- Eloquent ORM Code Hinting in PhpStorm
- Laravel Eloquent Sum of relation’s column
- What does “Mass Assignment” mean in Laravel?
- Laravel Checking If a Record Exists
- How to exclude certains columns while using eloquent
- Laravel 5 hasMany relationship on two columns
- Laravel Recursive Relationships
- Laravel Eloquent – Attach vs Sync
- How to create a subquery using Laravel Eloquent?
- Eloquent model mass update
- Difference between Eloquent\Model::get() and all()
- Natural ORDER in Laravel Eloquent ORM
- Eloquent many-to-many-to-many – how to load distant relation easily
- Find or Create with Eloquent
- Eloquent groupBy make “SQLSTATE[42000]” with valid SQL query in Laravel 5.3
- Laravel Eloquent update just if changes have been made