Laravel 12.52, weekly updates and tip
Laravel 12.52
Lots of fixes and additions in this week's release of Laravel 12.52. Here are the highlights:
- Add support for
temporaryUploadUrlto the local filesystem in #58499 - Only merge cached casts for accessed attribute in #57627
- Allow passing string-based expressions to
selectExpression()in #58753 - Add
$preserveKeysparameter toLazyCollection::random()in #58791 - Add
makeMany()toFactoryin #58795 - Add
withoutAfterMaking()andwithoutAfterCreating()toFactoryin #58794 - Display closures and standalone functions correctly on exception page in #58879
You may review the full branch diff on GitHub for a complete list of changes.
Weekly Journal
Last week I continued tweaking the Livewire Shifts. I also completed some refactors for the upcoming Laravel 13.x Shift. I'm hoping to have an alpha version ready for testing next week, and probably launch the pre-release on March 1.
I actually don't know the official release date. The docs say Q1. I am assuming it is going to be released after Laracon EU. Or maybe during. Either way, the Shift should be ready.
Also, in preparation for the upcoming release I'll start submitting PRs for community packages. I started this automation a few years ago. It's aimed at helping community packages add support for the latest Laravel version. These are packages tracked by the Can I Upgrade Laravel tool, or where the package author has explicitly asked for the Shift.
So we're entering peak Shift season. Lots of things to do.
Weekly Tip
I ran into something during a Human Shift last week, then received a support email the following day. So, I figured I'd share it as I found it interesting.
Middleware does not inherit when using the new static middleware method to register middleware via controllers. It did in previous versions of Laravel when using $this->middleware().
I feel like inheritance is uncommon in controllers. But I have seen it occasionally (like during Human Shifts). If you using inheritance in your controllers, there's a few options.
You could merge the middleware yourself. Easy enough for named middleware. Not so easy for closures or middleware limited to certain actions. You also need to do this all the way down the inheritance tree.
Or, you could replicate (copy) the parent middleware in the child class. I actually prefer this. It's a bit of duplicate code, but way more straightforward.