1
0
Fork 0
mirror of https://github.com/archtechx/laravel-tips.git synced 2025-12-12 21:34:03 +00:00
laravel-tips/content/tips/orderbyraw-is-very-useful-for-complex-sorting-in-eloquent.md
Samuel Štancl 99fc7428d1 Week 20/2022
2022-05-22 13:50:08 +02:00

587 B
Raw Blame History

title tweet_id thread_slug author_username images created_at slug
orderByRaw() is very useful for complex sorting in Eloquent 1527688616838803456 weekly-thread-2022-20 mattkingshott
https://pbs.twimg.com/media/FS-AaRbWAAA5Xfl.jpg
2022-05-20T16:32:03+00:00 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. Heres an example where I sort roles based on their level of importance (rather than their alphabetical order).