Laravel 8.82, weekly updates, and 🔥 tip
Couple fixes and new features in this week's release of Laravel 8.82.
- Fix autoresolving model name from factory in #40616
strtotimeEpoch doesn't fit in PHP int in #40690
- Ability to create cross joined sequences for factories in #40542
- Add Transliterate shortcut to
Strhelper in #40681
- Return collection from
prependconfig values for new keys in #40723
array_keysvalidation 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.
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 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.
In working on the default
orderBy feature for Laravel 9, I stumbled upon a few query builder methods.
I knew about the
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
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();