Laravel's new lazy loading prevention is fantastic, but depending on the size of your system might be hard to introduce. Here is an approach you might like to try out.
A (not so lightning) talk about git rebase and the things it enables.
When you are working with a one-to-many relationship, it is sometimes the case that a particular instance on the "many" side of the relationship is flagged as unique and important to your system in some way.
Conference talk given at the 2020 LaraconUS / Online conference. Come for a journey as I show you down the path I've taken along the Eloquent road.
I always thought Laravel's Policies and Route Model Binding were only able to be used with Eloquent models. Turns out I was wrong
A "note to self" on how to best handle moving from a classic foreign key constrained relationship, to a polymorphic relationship in Eloquent, without impacting the end user.
It can be very hard to spot a false positive within a test. So how do you avoid them?
This tutorial will show you how you can setup a repo that contains all your rules, and easily share them with others.
String concatenation is the current way we can pass arguments to Laravel middleware - but what if there was another way
Action scopes are...well...just query scopes really, but instead of filtering they take an action. It's just a random name I've given them to differentiate them from regular filtering based query scopes in my projects.
Deep diving the Laravel TestCase and pushing it to the limit, and yea...that's the title I went with 🕵️♂️
As my current project grew, so did my models. In a hunt for thinner models, I realised it was possible to extract model scopes to a dedicated query builder class. I'll show you how to do this, and a few things to keep in mind if you implement this refactor.
Monitoring your web application's performance is key to ensuring you provide a good experience for your users. Here is a tip to help you see where your app is slow on a Laravel Forge deployed server.
There are certain scenarios where PHP does not check or error if a class you reference does not exist. These are their stories. *dun-dun*
Having a fast test suite can be just as important as having a fast application. Here are some ways to make your test suite run faster.
In applications it is often useful to have a way to store some global settings. This post outlines my approach using a Spatie package to manage the values instead of Eloquent.
Laravel collections have become an essential part of my codebases and I couldn't imagine working without them. I have found giving collections the voice of the problem domain makes for a much nicer API when compared to the generic collection methods.
I do love a good feature test suite. I especially like them to be fast and, most importantly, trustworthy! As my approach has matured, and become stable, I thought I'd share how I go about setting things up.
Laravel's global mix helper function can be replaced during testing in Laravel 5.8. Here is why, and how, you might want to do this.
There are several ways to load relationship counts on eloquent models. I'm going to explore the options and introduce you to a new one.
I've found that introducing dedicated response objects that can handle multiple response formats is a really nice pattern to cleanup my controllers
If you are creating a Laravel app with subscriptions via Stripe - Laravel Cashier might just be the helping hand you were looking for.
Using Spatie's Laravel Backup package you can backup several sites on a server from a single app install, including Laravel apps and WordPress sites.
A foreign key validation rule for the Laravel Validator that helps wrap up the 'exists' rule with a bit of syntactic sugar. Probably not fantastic to work with in the traditional fashion, but using the rule builder package...it looks gooooood!
A little trick I have been implementing recently to ensure that data accessed from a Laravel request object has first been validated.
Having never written a shell script before, I thought I'd try and level up my dev skills by writing a simple deployment script for my website and my clients websites. The outcome: FlipIt™
Laravel validation rules are great, but wouldn't it be awesome if there was a fluent interface for all the rules.
If you're in the Riverina and wanna meet up to discuss all things software - join our local developer Meetup.