Laravel 8.82, weekly updates, and 🔥 tip
Laravel 8.82
Couple fixes and new features in this week's release of Laravel 8.82.
- Fix autoresolving model name from factory in #40616
- Fix
strtotime
Epoch doesn't fit in PHP int in #40690 - Ability to create cross joined sequences for factories in #40542
- Add Transliterate shortcut to
Str
helper in #40681 - Return collection from
ucsplit
in #40699 - Allow
push
andprepend
config values for new keys in #40723 - Add
array_keys
validation rule in #40720
You may review the full branch diff on GitHub for a complete list of changes.
This 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 made some tweaks to the Laravel 9.x Shift. More changes were made in the last few days, so I'll work on automating those later this week.
I also spent some time tweaking and running the old package updater script. This opens a PR for the top 300 packages collected from Shift's Can I upgrade Laravel yet?.
I also stumbled upon an edge case within Shift. Certain tasks which filtered files may have caused Shift to check all files within a project. This likely resulted in false positives listed in some of the comments.
I did notice such comments in some of my own PRs. Yet it was the new testing layer which ultimately revealed this edge case. I know I've mentioned this before, but switching to a more integration style testing layer has not only improved the developer experience, but also identified multiple edge cases.
As such, Jess and I decided to record another miniseries for The BaseCode Podcast. This will go in-depth on this new testing layer. We released the first episode earlier today.
🔥 Tip
In working on the default orderBy
feature for Laravel 9, I stumbled upon a few query builder methods.
I knew about the latest
and oldest
methods. However, I didn't realize they accepted an optional parameter. By default, they sort on created_at
. But, you may pass the column to sort on.
So you may use these methods if you find them more human readable than orderBy
or orderByDesc
. In fact, we may even make this a free task within the Workbench.
The new one I found was reorder
, which removes any previously defined orderBy
. You may also pass in a new column and direction to order by.
$query = User::latest('login_at'); // ... $users = $query->reorder('role', 'desc') ->get();