Home >PHP Framework >Laravel >The latest Laravel 9.37 has been released, bringing these new changes!
The Laravel team released version 9.37 this week and also released some patches between 9.37 and Laravel 9.36. This week’s release adds support for preloading resources with Vite, new strict violation handlers, CLI output verbose view caching, and more.
Verbose View Cache
Contributed by Andrew Brown Passing -v# in the
view:cache command ## function to output the directories the command is looking for, as well as to view each file in the command cache via
-vv. [Related recommendations:
laravel video tutorial]
php artisan view:cache -vvThis is an example, you will see the situation of the newly installed Laravel 9.37:
How to Handle Silent Drop vs. Attribute Missing
Aaron Francis provides a way to register handlers for "Silent Drop" and "Missing Attribute" strict mode conflicts Function:Model::handleMissingAttributeViolationUsing( function ($model, $key) { // ... });Model::handleDiscardedAttributeViolationUsing( function ($model, $keys) { // ... });
Closure for passing rescue report parameters
Contributed by @foremtehan when usingrescue() Pass the callable object as the
$report parameter so that you can conditionally report errors based on the returned boolean value:
rescue(fn() => 'error', fn() => 'rescue', function(Throwable $e){ return $e instanceof SomeException;});
Support using Vite pre- Loading resources
Tim MacDonald uses Vite to preload the resources required for the current page. It is now the default behavior for Laravel applications using Vite. The details of how it works are quite complex and I recommend reading Pull Request #44096. Additionally, you can learn more about the general concepts behind preloading critical resources to improve loading speed.Query constructor RawValue method
@eusonlito contributed therawValue() method, which supports the use of SQL expressions to obtain values. Here are some usage examples:
$first = TripModel::orderBy('date_at', 'ASC') ->rawValue('YEAR(`date_at`)');$last = TripModel::orderBy('date_at', 'DESC') ->rawValue('YEAR(`date_at`)');$fullname = UserModel::where('id', $id) ->rawValue('CONCAT(`first_name`, " ", `last_name`)');
Release Notes
You can check out the full list of new features and updates for 9.36.0 below and 9.37.0. The following release notes are from the changelog:v9.37.0
(#44703)
v9.36.4
Add handlers for silent discard and missing attribute conflicts (#44664)v9. 36.3
Illuminate/Database/Eloquent/Model::offsetExists()
(#44642)##v9.36.2
v9.36.1
Original address: https://laravel-news.com/laravel-9-37 -0Translation address: https://learnku.com/laravel/t/72839
The above is the detailed content of The latest Laravel 9.37 has been released, bringing these new changes!. For more information, please follow other related articles on the PHP Chinese website!