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
- Episodes (29)
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.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.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.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.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.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.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.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.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.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.Laravel Just Destroyed Your N+1 Problem
Writingwith()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.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.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.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.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.Using Laravel's New nullOnUpdate() Method
A recent update introduced thenullOnUpdate()method when defining migrations. It's a little obscure, but it can be quite useful in certain cases. Let's have a look together.Simpler Conditionals with <code>when()</code>
Laravel has seen many new features, including the newwhen()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!Laravel's Flexible Cache is a Game Changer
Laravel 11 now includesCache::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!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.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.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.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.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.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.Introduction to Laravel Precognition
Form validation has always been a thorn in our side. Not only do we have to validate data on the server, but for the sake of UX, we also need to replicate that validation on the client. No more! Let me introduce you to Laravel Precognition, which allows us to use our server-side validation in the browser.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!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.How to Recycle Laravel
Frustrated with tying related model instances together when using your factories? Laravel'srecycle()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.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!
