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/yesterday-in-my-at-laracononline-talk-i-explained-how-to-use-the-query-builder-when-method-to-handle-complex-sorting.md
2021-04-07 20:16:47 +02:00

598 B

title tweet_id thread_slug author_username images created_at slug
Yesterday in my @LaraconOnline talk I explained how to use the query builder when() method to handle complex sorting 1233017064492761088 1-rt-1-tip reinink
https://pbs.twimg.com/media/ERyNRSIX0AEjjWo.jpg
2020-02-27T13:12:31+00:00 yesterday-in-my-at-laracononline-talk-i-explained-how-to-use-the-query-builder-when-method-to-handle-complex-sorting

What you may not realize is that the when() method also accepts a second callback for the falsy case. This is really helpful for setting a sort default. 🤩