# Changing your mind about when() and unless() in Eloquent Page: https://stenobird.com/podcast/no-compromises-1309932/changing-your-mind-about-when-and-unless-in-eloquent Text version: https://stenobird.com/podcast/no-compromises-1309932/changing-your-mind-about-when-and-unless-in-eloquent.md Podcast: [No Compromises](https://stenobird.com/podcast/no-compromises-1309932) Published: 2025-08-02T05:00:00+00:00 Episode link: https://share.transistor.fm/s/664d231e Audio file: https://media.transistor.fm/664d231e/c3bda97b.mp3 Processing state: not_requested JSON: https://stenobird.com/v1/public/podcasts/no-compromises-1309932/episodes/changing-your-mind-about-when-and-unless-in-eloquent Duration seconds: 662 ## Resource Aaron admits he used to wrap every query in plain old if-statements—until Laravel’s when()/unless() helpers (and arrow functions) won him over. He and Joel compare their journeys, debate readability trade-offs, and share guidelines for deciding which style to use. Along the way they discuss false assumptions, evolving “code grammar,” and how tools such as Rector can automate the switch. (00:00) - Intro – refining long-held opinions (00:45) - Aaron’s original “query-then-if” pattern (01:45) - Why when() first felt clumsy (closures, scopes, extra params) (03:45) - Arrow functions & smaller conditions make when() nicer (05:00) - Joel’s lingering objection: avoiding unless() for readability (06:45) - Seeing the same helper everywhere changes minds (08:30) - Takeaways – keep revisiting old habits as Laravel evolves (09:30) - Silly bit Want help learning how to more quickly refactor and standardize your app with Rector? ## Actions - request_transcript: `POST https://stenobird.com/v1/public/podcasts/no-compromises-1309932/episodes/changing-your-mind-about-when-and-unless-in-eloquent/transcription-requests` — Idempotently request low-priority transcript generation for this episode. - read_markdown: `GET https://stenobird.com/podcast/no-compromises-1309932/changing-your-mind-about-when-and-unless-in-eloquent.md` — Read the agent-friendly Markdown representation of this episode resource. A page view does not enqueue transcription. Agents should invoke `request_transcript` explicitly when they need this episode processed. ## Transcript Full transcripts are not published on public pages unless there is a clear rights basis.