Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Browse all series

Jeremy's Larabits

Here, you'll find Jeremy McPeak's personal collection of Larabits. If you're unfamiliar, Larabits are short, isolated lessons that focus on a single concept or technique. While a typical series may take hours to work your way through, Larabits are instead for when you have five or ten minutes to pick up a small bit of knowledge.

Please keep in mind that each of these lessons is self-contained and may be viewed in any order. Happy learning!

Progress

Series Info

Episodes
29
Run Time
5h 34m
Difficulty
Intermediate
Last Updated
Apr 30, 2025
Version
Latest

Series Episodes

  1. Episodes (29)
    1. Should You Use Big Models or Services?

      When should you keep logic in your Eloquent models, and when should you extract it into a service class? Let's walk through an example to find that balance between large models and clean, testable services.
    2. Where Should This Code Go?

      You've written a query or transformation in Laravel. Now for the real question: where should it live? The controller? The model? A service class? In this Larabit, we'll take a real-world example and walk through three possible homes for the code.
    3. Code Confession: I Don't Write Tests... Until I Have To

      I often don't write tests...until something breaks. I'll show you a real-world bug that forced me to write one. It's not pretty, but it saved me from repeating the same mistake twice.
    4. Should You Keep it Simple, Or Abstract Away?

      When should you reach for a Form Request in Laravel—and when is it overkill? In this Larabit, we explore the judgment calls behind inline validation vs. dedicated request classes.
    5. Single Action All The Controllers?

      What if every controller only had one job? Let's explore the idea of using single-action controllers exclusively, and whether it leads to cleaner, more maintainable code or just a cluttered directory.
    6. Laravel's New UseFactory Attribute

      Laravel 11.39 introduced the UseFactory attribute - a cleaner, more explicit way to associate Eloquent models with their factories. It removes the need for newFactory() and works perfectly even when your factories don't follow Laravel's naming conventions.
    7. Inline Event Listeners In Laravel (No Class Required)

      You don't need to create a listener class just to respond to a Laravel event. Sometimes, a single Event::listen() in a service provider is all you need to debug or add environment-specific logic.
    8. Single Action Controllers: One Job, Done Right

      Not every action in your app fits neatly into CRUD. Learn how Single Action Controllers keep your Laravel projects clean, organized, and stress-free — one small, focused controller at a time.
    9. No Js Framework? No Problem.

      Sometimes, we don't have the ability to use a JavaScript framework. Instead, we must stick with vanilla JS and raw DOM elements. It can feel old-school, but with just a bit of effort, we can build our own tools to make it nicer to work with.
    10. Better Forms, Less Effort

      Forms can be tedious, but UseMods makes them easier with powerful utilities that streamline validation, submission, and more. In this video, we'll explore how UseMods actions can save you time and effort while improving your form workflows.
    11. Laravel Just Destroyed Your N+1 Problem

      Writing with() each time you fetch related data can often be verbose and tedious. Worse, forgetting it can lead to unexpected N+1 issues. Thankfully, as of Laravel 12.8, you can let the framework automatically eager load relationships based on what your code actually uses.
    12. Deployment With Laravel Cloud In Seconds

      The mantra of the Laravel team is 'we must ship.' The brand new Laravel Cloud certainly reflects that philosophy. It takes literal seconds to deploy an application with Laravel Cloud. You read that correctly: seconds. Let's take a look at the process and what Laravel Cloud has to offer.
    13. You Can Write Your Own Laravel Facades

      Facades in Laravel provide a clean and expressive way to access services, and they abstract away the complexity of resolving dependencies from the service container. But did you know that you can also write your own Laravel facades? Let me show you how.
    14. Laravel's Service Container Explained in One Minute

      Laravel's service container is a key piece of the framework. Think of it, well, like a box! You can place things into this box, and then fetch (or resolve) them out of the box whenever you require them.
    15. How to Write Custom Helpers Functions

      Helper functions are an integral part of every application, but we sometimes want to write and use our own. Let's look at how we can write and incorporate our own helper functions into our Laravel applications.
    16. Using Laravel's New nullOnUpdate() Method

      A recent update introduced the nullOnUpdate() method when defining migrations. It's a little obscure, but it can be quite useful in certain cases. Let's have a look together.
    17. Simpler Conditionals with <code>when()</code>

      Laravel has seen many new features, including the new when() helper function. It offers a simple way to handle conditional logic in your code, making your code more concise and readable. Let's check it out!
    18. Laravel's Flexible Cache is a Game Changer

      Laravel 11 now includes Cache::flexible(), a cache method that automatically refreshes the cache with up-to-date data after a certain amount of time. This is a game-changer. So, be sure to see how it works!
    19. Routing with Attributes

      In this Larabit, I'll introduce you to the power of routing with attributes in Laravel. This modern approach streamlines your routing definitions, potentially making your code more readable and maintainable.
    20. Using Generics with PHP

      PHP doesn't support generics, but oh... I wish it did. We do, however, have the next best thing: our tooling supports generics! It can be confusing at first, but let me show you the entire workflow.
    21. Popping Over with Popovers

      We use popovers for so many features in our applications. Toasts, search boxes, and notifications are just a few of the ways we commonly use them. HTML now has offers native support for popovers. Let's have a look at how we can use them.
    22. How to Provision a Server on Digital Ocean

      Laravel Forge provides an easy way to provision a server and deploy applications, but, if you prefer, you can also handle the entire process manually on Digital Ocean. Join me as I deploy a Laravel application using Digital Ocean's App Platform.
    23. How to Provision a Server with Laravel Forge

      We spend a lot of time developing a project, but we ultimately need to deploy it to a server. In this Larabit, I demonstrate the step-by-step process you need to follow when provisioning a server with Laravel Forge.
    24. Everything You Need to Know About Laravel in 30 Minutes

      Are you an experienced developer, but brand new to Laravel? No worries! I'll show you how to define routes, validate input, use views, and interact with the database - effectively everything you need to get up and running as quickly as possible.
    25. Laravel Development on a Windows Machine

      Mac Mac Mac. What about Windows? Let me show you my development environment and how I build Laravel applications on Windows. We'll also review Laragon and Herd for Windows!
    26. How to Bulk Insert Data

      As programmers, we often need to bulk insert a massive number of records into a database. Some languages and platforms offer built-in tools that make bulk insert a trivial thing. PHP (and Laravel), however, don't have these tools. But we can still efficiently bulk insert data! Let me show you how in this Larabit.
    27. How to Recycle Laravel

      Frustrated with tying related model instances together when using your factories? Laravel's recycle() method makes it incredibly easy to create related model instances with your factories. It can be confusing to describe, so let me show you how it works in this Larabit.
    28. HTMX May Be All You Need

      HTMX is an excellent new tool that simplifies the process of building modern user interfaces. Using nothing but HTML attributes, it provides instant access to AJAX, CSS transitions, WebSockets, and more. Hi, I'm Jeremy. In this bit, we will build a search form that includes paginated results... using nothing but HTMX!

Continue Learning