Laravel 8.39, weekly updates, and 🔥 tip

Laravel 8.39

This week we have a few fixes, mostly for PHP 8.1, as well as several new features. That warrants a minor version bump, bringing us to 8.39.0.

Here are the highlights:

  • Fix executing beforeSending callbacks twice in #37116
  • Fixes for PHP 8.1 in #37101
  • Fix nullable values for required_if in #37128
  • Support database_url for artisan db command in #37064
  • Added sole() and soleWhere() for Collections in #37034
  • Add Cookie::expire() in #37072
  • Add attemptWith() to Guard in #37090
  • Add new Password validation rule in #36960

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 Jess and I continued to pair on the secret project. We're making some good progress. At this point, everything's been proven out. Now it's time to go back and fill in all the blanks. We hope to do a private alpha release mid-May.

I'm still finishing up one more Human Shift. It was actually a project which claimed to be "upgraded". Unfortunately the developer simply bumped the Composer dependencies and called it "done".

You might be able to get away with that for a version or two, but eventually the wheels fall off. When they do, they fall off hard. It really creates a bad situation for everyone. Something I tweeted about last week.

This week I hope to continue on the secret project by working on some of the administrative components. I also have a few tweaks I want to make to the Tailwind Shifts before officially releasing them next Monday.

Something else I have been considering is revisiting the Laravel 8.x Shift and bumping the price. Some of its automation was separated into the Workbench - which doesn't get the use it deserves. So I'm concerned there is some fall off.

This particular change is around converting to class based routes. It's a paradigm change and a rather large one depending on the app. For those reasons, I didn't include the automation originally. But as Laravel and the community has continued to adopt this convention, it's here to stay and will likely be required in a future version.

I figured I would include it when that happened, which would likely coincide with its price increase. Normally I leave the latest version $9, but the previous release cycle was only six months. Now with it being a year you're getting more and more automation from the latest version Shift as time passes. Anyway, I welcome your thoughts.

🔥 Tip

As part of the secret project I needed to update some existing values within a JSON database column. Of course I could script this with PHP, but I set out on the path of learning how to do it solely with a MySQL query.

There are numerous functions for querying and manipulating JSON. Candidates like JSON_CONTAINS(), JSON_SEARCH(), JSON_SET(), JSON_REPLACE().

However, my data was a bit unstructured and due to its potential nesting these functions wouldn't work. At least not within a single query. Randomly, I tried simply using string replacement on the column with REPLACE(). And it worked!

So the 🔥 tip this week is if you need to update a particular value within a JSON column and feel it's unique enough to generically search and replace, you may do so in one simple query:

1UPDATE build_runs SET tasks = REPLACE(
2 tasks,
3 'shift/laravel-package-dependencies',
4 'composer/laravel-package-dependencies'
5);