Laravel 8.42, weekly updates, and 🔥 tip
Laravel 8.42
Couple of new new additions this week, so we bump to 8.42. As an aside, this version can be broken down into the equation 8 % 4 = 2 (I like numbers).
Anyway, here are the highlights:
- Add
assertDispatchedSync
toBusFake
in #37350 - Add
withExists
to model relationships in #37302 - Add
loadExists
to model relationships in #37388 - Allow setting a refresh header with maintenance mode response in #37385
- Add "one-of-many" relationship in #37362
You may review the full branch diff on GitHub for a complete list of changes.
This minor version bump and update is automated for subscribers to a Shifty Plan. If you don't have one of those, be sure to bump your constraint and run composer update
to get the latest features.
Weekly Journal
Last week I mostly worked on the secret project. Specifically Thursday pairing with Jess and demoing to Freek Van der Herten and Bobby Bouwmann. I jokingly referred to them as "Laravel Elite" in last week's newsletter. But really they had demoed some of their own projects for me before, so I wanted to return the favor. For the record, I consider Michael Dyrynda included in the "Laravel Elite". Jess is showing him an early demo as well.
Jess and I paired this morning to implement some of the feedback from the demos. She also finished up the UI for the build output. It looks super cool. So I will probably tease a screenshot of it on Twitter later in the week.
I also made the decision to increase the price of the Laravel 8.x Shift. This will take effect June 1. At that time this Shift will be updated to automate all of the "optional" changes. For example, the conversion to class-based routes.
Historically I left these "optional" changes out for one version. This allowed time to ensure they became stable and were more widely adopted by the community. After the next Laravel release, both Shifts were updated to automate the change. This also coincided with the standard price increase for older Shifts.
Now that Laravel has moved to an annual release cycle, this vetting period is longer than it needs to be. Which makes me feel like I'm "holding back" automation. This was confirmed in recent support emails where users asked why such automation was not included by default.
So on June 1, it will be. The Laravel 9.x Shift will start at $9 and also include this automation for any app already running with the "optional" Laravel 8.x changes. Of course, in the meantime you may run the Laravel Fixer or use the Shift Workbench to automate these conversions.
🔥 Tip
The other week I tweeted a 🔥 tip I wanted to re-share. It's actually something I remember about the the isset
function in PHP - it accepts multiple arguments.
This allows you to streamline multiple calls such as:
1if (isset($a) && isset($b) && isset($c)) {2 // ...3}
into simply:
1if (isset($a, $b, $c)) {2 // ...3}
Just be mindful not to introduce any logic bugs when collapsing multiple calls. Especially if you're negating their result.