Laravel 9.43 Released
Published on by Paul Redmond
The Laravel team released 9.43 this week with the ability to specify columns eagerly with withWhereHas()
, the model:show command now lists model policies, a new Stringable method, and more:
Add support for eager-loading specific columns with "withWhereHas"
Diaa Fares contributed eager-loading specific columns while using withWhereHas()
. This method now works in the same way as Model::with()
:
Model::withWhereHas('user:id,first_name,last_name');
List model policies in the model:show command
Andy Hinkle contributed adding model policies to the output of models in the Artisan model:show
command:
This is helpful to see which policies are attached to a given model.
whenIsUlid
method
Stringable Michael Nabil contributed a whenIsUlid()
method that will run a given callback when a Stringable
instance is a Universally Unique Lexicographically Sortable Identifier (ULID):
str('01GJSNW9MAF792C0XYY8RX6QFT')->whenIsUlid(function () { // Your code});
Release Notes
You can see the complete list of new features and updates below and the diff between 9.42.0 and 9.43.0 on GitHub. The following release notes are directly from the changelog:
v9.43.0
Added
- Add support for eager loading specific columns to withWhereHas (#45168)
- Add Policies to Model Show Command (#45153)
- Added
Illuminate/Support/Stringable::whenIsUlid()
(#45183)
Fixed
- Added missing reserved names in GeneratorCommand (#45149)