Back to Browse

Where Should This Code Go?

5.2K views
Oct 1, 2025
7:02

Naming things and deciding where to put code might just be the toughest parts of programming! In this video, Jeremy McPeak walks through a real Laravel example: retrieving recently published articles. Should the query live directly in your controller? Should you extract it into a model scope? Or maybe wrap it inside a dedicated service class? Each option has pros and cons—from simplicity to reusability to keeping your codebase clean. Jeremy explains the trade-offs in a practical, easy-to-follow way, so you can decide which approach works best for your project. Let’s make coding decisions less stressful together! Also available at: https://laracasts.com/series/jeremys-larabits/episodes/28 Watch thousands of videos, track your progress, and participate in a massive Laravel community at Laracasts.com. Laracasts: https://laracasts.com Laracasts X: https://x.com/laracasts

Download

0 formats

No download links available.

Where Should This Code Go? | NatokHD