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