orderByRaw() is very useful for complex sorting in Eloquent
- ·
- Telegram
- ·
- Newsletter
🔥 #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).