orderByRaw() is very useful for complex sorting in Eloquent

orderByRaw() is very useful for complex sorting in Eloquent

🔥 #Laravel Tip: Make use of ‘orderByRaw’ when you need to sort records in a more complex manner than simply A-Z or Z-A. Here’s an example where I sort ‘roles’ based on their level of importance (rather than their alphabetical order).

We're writing a book, you can get it for free here.