Posts List

Multi-word Route Parameters in Laravel

We all make stupid mistakes from time to time. I’m sharing this one to hopefully save someone else a little frustration.

Why I Switched My Podcast to Transistor

Podcast hosting is one of those things that feels very difficult to change. I worked hard to build an audience and I didn’t want a behind-the-scenes technical change to break any subscriptions and alienate listeners. As a result, I kept putting off the move to Transistor. Well, I finally took the plunge, and I’m happy to report it was much easier than I anticipated. Before we get into the details, I want to step back and explain my motivation to move in the first place.

Validating File Upload Arrays in Laravel

Let’s say you have an HTML form with 3 file inputs named certificate[], and you want to make them all required. Should be pretty easy, right?

Digging Deeper Into Laravel Password Validation

Recently, a powerful new validation rule was added to Laravel to enforce password strength and security. There have been several great articles on how to use it, but this article will dive deeper and shed some light on how it works internally.

Will My Laravel App Break on March 23?

Maybe you’ve received a notice from Amazon that certificates are changing on your S3 bucket on March 23, 2021. Several people have asked me: Will my Laravel app break on March 23?

Routing Resolution Can Change When Caching Routes

Recently I ran into a change in behavior in my app depending on whether routes were cached or not. Here’s what I found, and how I dealt with it.

Why Are Eloquent Timestamps Nullable?

Recently I was creating a new table and using the timestamps helper in the migration. I noticed something that seemed wrong, so I dug a little deeper and learned something new about Laravel and MySQL.

Covering Value Ranges in Your Tests

For me, one of the main reasons I write tests is to have confidence that my code is working as expected and to catch myself if (or should I say when?) I break something in the future. I often think of testing the happy path and the failure path, but I’ll share some additional things I like to test in between that further boost my test confidence.

Access the Model Inside a Form Request

Laravel’s form requests really help reduce the amount of code in your controllers, especially around validation. Another convenience method they offer is authorization. I recently came across a small tip which isn’t explicitly stated in the docs and thought I’d share it.

Toggling Groups of Related Fields in Update Request

Let’s say you have a form with two groups of related, but mutually exclusive, fields. When you POST and store a new record, no problem, only the right fields are sent in. But what do you do when that record is updated? How can you cleanly handle this?