Laravel 8.43, weekly updates, and 🔥 tip
There was a patch release last week to correct a low-level change to loading service providers. This week we have a few new additions, bringing us to 8.43.0.
Here are the highlights:
- Allow database password to be
- Updates to "of many" relationship in #37411 and 5dc1882d
- Allow any instance of
Passwordvalidation in #37407
beforeQueryto base query builder in #37431
- Add a
failOnTimeoutsjob property in #37450
ValidatorAwareRuleinterface in #37442
- Allow passing model/class references to database assertions in #37459
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.
First, let me correct my equation from last week:
8 / 4 - 2 = 0. I am good at math, but bad a proofreading equations. In my mind, I was visualizing the division operator as a line with two dots and used
%. I blame it on new parent brain. Hopefully I'll type the equation correctly when 8.44.0 is tagged.
Last week I made some tweaks to existing Shifts. There were a few items on the bug list which were reported again in recent support emails. So I took a morning to get those resolved.
I also continued working on the secret project. We have pretty much been functionally complete for about a week now. However, as with all projects, the last 10% takes 90% of the time. So hopefully we will complete these final touches this week.
This project has reminded me about the nuances of YAGNI. While I do think most developers still need to adopt practicing YAGNI in general, it is still hard knowing which path best fits YAGNI.
In the end, what is important is calling YAGNI as best you can. So, even if you were to choose the "wrong" path, it shouldn't be too costly to change.
My main focus this week will be the "marketing tasks" for the secret project, such as the landing page and checkout flow.
I also need to make a few updates to the Laravel 8.x Shift in preparation for the price increase next Thursday. To that point if you've been waiting to upgrade, this is your last chance to take advantage of that super low $9 price point.
In fixing one of the errors for Shift, I was reminded of a subtle difference between
array_key_exist. Which was also a bug fix in this Laravel release. The combination of the two made me feel it was worth sharing as a tip.
array_key_exists tests if an element with the key exists within the array.
isset checks if an element with the key exists within the array and it is not
null. It's that last part which is the key difference (no pun).
Consider the following example:
1$items = ['a' => 1, 'b' => 2, 'c' => null];23isset($data['c']); // false4array_key_exists('c', $items); // true
So, if you're simply checking for the existence of a key,
array_key_exist should be used. It also communicates much better.