Laravel can spot a lazy loaded relationship inside a loop and load it for the whole collection at once. But it doesn't do quite the same thing as chaperone. masteringlaravel.io/daily/2026-1...
Joel Clermont
Joel Clermont
@jclermont.com
๐ Author of Mastering Laravel Validation Rules โ๏ธ I post useful Laravel tips https://masteringlaravel.com ๐๏ธ Co-host of https://show.nocompromises.io podcast ๐ Organizer of Milwaukee PHP
3.6K followers168 following1K posts
Most .env.example comments just disable a line. A short note about why you'd change a value can save your team, and even your AI agent, some confusion. masteringlaravel.io/daily/2026-1...
You mocked one method and expected the rest of the class to behave normally. So why didn't the constructor run? masteringlaravel.io/daily/2026-1...
You eager loaded the posts and their comments. So why does every comment still run a query to find its post? masteringlaravel.io/daily/2026-1...
Your file upload returns false, and Laravel won't tell you why. One config option turns that silent failure into a useful error. masteringlaravel.io/daily/2026-1...
Eloquent's date cast hides the time when you read a value, but saves it anyway. If you're stuck with a DATETIME column, there's a small fix. masteringlaravel.io/daily/2026-1...
Your compose file maps MySQL to port 3306, but a teammate already has something running there. There's a cleaner fix than an override file. masteringlaravel.io/daily/2026-1...
Caching Composer dependencies in GitHub Actions is easy thanks to the lock file. But what about a tool like PHPStan that has no lock file to hash? masteringlaravel.io/daily/2026-1...
A validation rule keeps overly long passwords out of your forms. But if one ever slips past it, would you rather bcrypt truncate it quietly or fail loudly? masteringlaravel.io/daily/2026-1...
Someone pastes your API URL into Slack, and suddenly your logs fill up with errors about a missing login route. Here's a small way to stop it. masteringlaravel.io/daily/2026-1...
Validating max password length protects you from bcrypt's silent truncation. Mostly. Here's the case it misses, and a small rule that closes the gap. masteringlaravel.io/daily/2026-1...
The test passed, but it built its expected string with the same logic as the code it was testing. So what was it actually proving? masteringlaravel.io/daily/2026-1...
Private channels control who can listen to your websocket messages. But what about the provider sitting in the middle? Let's see how to encrypt messages so even Pusher can't read them. masteringlaravel.io/daily/2026-1...
I created a record, and the database had the right primary key. But the model in memory said it was 0. What was going on? masteringlaravel.io/daily/2026-1...
Why would a user without permission get a 404 instead of a 403? Let's look at how Laravel orders authorization and route model binding. masteringlaravel.io/daily/2026-1...
If you've tried to stop Claude Code from adding itself to your commits with stern instructions, you've probably noticed they don't always stick. Here's a way to fix it for good. masteringlaravel.io/daily/2026-1...
That old switch statement has worked for years, and adding one more case would only take a minute. But could it be cleaner? masteringlaravel.io/daily/2026-1...
A handful of valid US postal codes kept returning no results from the Google Maps API. Let's look at the simple trick that got them working. masteringlaravel.io/daily/2026-1...
Blade's loop variable makes it easy to treat the first or last item differently. But is it always the right tool for the job? Let's look at a couple of examples. masteringlaravel.io/daily/2026-1...
Starting an Xdebug session for a web request is easy. But what about a queued job picked up by a worker? Let's see how to step through it line by line. masteringlaravel.io/daily/2026-0...
You've decided to pin your GitHub Actions to commit hashes. How do you convert a whole repo, and how do you keep it that way? Let's look at some tools that help. masteringlaravel.io/daily/2026-0...
Have you ever had someone review your pull request, make changes without telling you, and just merge it in? In this week's podcast, Aaron and I discuss whether the traditional code review workflow still makes sense when AI tooling lets us move faster than ever. masteringlaravel.io/daily/2026-0...
Moving to a new database server is a great time to clean up warnings hiding in your schema. Let's see how to find them and fix them before the import. masteringlaravel.io/daily/2026-0...
Pinning your GitHub Actions to a commit hash is more secure, but who wants to update all those hashes by hand? Let's look at how to automate it. masteringlaravel.io/daily/2026-0...
Importing a big database dump can leave you staring at a silent terminal, wondering if anything is happening. Let's look at a small tool that fixes that. masteringlaravel.io/daily/2026-0...
Once you pin a GitHub Action to a specific commit, how do you find out if that version has a security problem? Let's look at a tool that can tell you. masteringlaravel.io/daily/2026-0...
Aaron and I disagreed about how to reference third-party actions in our GitHub workflows. One side has a real-world attack to point at. Let's look at both arguments. masteringlaravel.io/daily/2026-0...
Not every factory field requires a named state. Here's the simple rule I use to decide which ones do, and why I still add a state for the default value. masteringlaravel.io/daily/2026-0...
Here's a fun little exercise to see if your code could be improved. Read it out loud. Let's look at an example that demonstrates it. masteringlaravel.io/daily/2026-0...
Importing old data into a stricter MySQL server can fail on things like zero dates. Here's how to relax sql_mode for just the import session, without changing the server's configuration. masteringlaravel.io/daily/2026-0...
A queued job that manually builds an expensive service is painful to test. Let's see how to leverage Laravel's container to make this a lot nicer. masteringlaravel.io/daily/2026-0...
Ever notice that some Docker containers stop instantly while others hang for ten seconds? I'll explain why and show how to fix it. masteringlaravel.io/daily/2026-0...
Laravel doesn't require a primary key on a pivot table, and the relationship works fine without one. Here's why I add one anyway, and the replication problem it avoids. masteringlaravel.io/daily/2026-0...
After adding Compose watch to a project, every rebuild paused for ten seconds before the new container came up. If your restarts drag like that, here's a workaround that may help improve speed. masteringlaravel.io/daily/2026-0...
When another site loads your built JS assets, Laravel never sees the request, so its CORS config can't help. Here's how to add the headers in Nginx for just those files, without slowing down everything else. masteringlaravel.io/daily/2026-0...
I joined a project where the Vue front end was built into the Docker image with no bind mount, so every change meant a manual rebuild. One addition to the compose file turned that back into a normal dev loop. masteringlaravel.io/daily/2026-0...
Ever handed off a feature request with barely any detail and expected the developer to just figure it out? In this week's podcast, Aaron and I make the case for writing requirements before development starts, and why letting AI write them for you is a trap. masteringlaravel.io/daily/2026-0...
If another site loads a script built by your Laravel app, switching to Vite can quietly break it. Here's the CORS gotcha we hit and how we fixed it. masteringlaravel.io/daily/2026-0...
Laravel serializes a model's loaded relationships when you queue a job, but not when you queue a collection of models. Here's the right way to load relationships inside the job. masteringlaravel.io/daily/2026-0...
Sometimes multiple controller actions need the same guard logic, but it doesn't belong in a policy or form request. Here's a clean way to share redirect logic without messy hacks. masteringlaravel.io/daily/2026-0...
Pennant defaults to the database driver, but not every feature flag needs a table row and a query. Today's tip shows when the array driver is the lighter choice. masteringlaravel.io/daily/2026-0...
Pennant defaults to the database driver, but not every feature flag needs a table row and a query. Today's tip shows when the array driver is the lighter choice. masteringlaravel.io/daily/2026-0...
Converting an Eloquent casts property to the newer casts method looks like a pure style choice for which syntax you prefer, but here's a real-world example where the two behave differently. masteringlaravel.io/daily/2026-0...
Dropping an index in a down migration usually means guessing at its name. Today's tip shows a cleaner way that lets Laravel figure it out for you. masteringlaravel.io/daily/2026-0...
Laravel redirects back to the previous page when validation fails, but what happens when there is no sensible previous page? Today's tip covers a redirect loop that shows up with bookmarks and new tabs, and a simple way to stop it. masteringlaravel.io/daily/2026-0...
Automated tests catch most bugs, but not all of them. Today's tip is a reminder of why I still click through the app before pushing my code. masteringlaravel.io/daily/2026-0...
JSON language files use the string itself as the key, so where does the pluralization pipe go? Today's tip shows it works exactly like array files, once you get past how strange it looks. masteringlaravel.io/daily/2026-0...
Ever been told your slow app just needs caching? In this week's podcast, Aaron and I break down the layers of caching in a Laravel app, from the Cloudflare edge down to in-request memoization. masteringlaravel.io/daily/2026-0...
In today's video, watch a paginated list quietly show some records twice while never showing others, and see the one-line fix that makes pagination deterministic. masteringlaravel.io/daily/2026-0...
Most factory states just flip a flag, but they can also accept arguments. That opens up some useful patterns, like deriving test data from another model. masteringlaravel.io/daily/2026-0...