Home >PHP Framework >Laravel >The latest Laravel 9.37 has been released, bringing these new changes!

The latest Laravel 9.37 has been released, bringing these new changes!

藏色散人
藏色散人forward
2022-11-04 17:02:481568browse

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 -vv
This is an example, you will see the situation of the newly installed Laravel 9.37:

The latest Laravel 9.37 has been released, bringing these new changes!

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 using

rescue() 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 the

rawValue() 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

Add

    Add Optional verbose output when views are cached (#44673)
  • Allow passing closures to save $report parameters (#44710)
  • Support preloading resources with Vite (#44096)
  • Add
  • Illuminate/Mail/Mailables/Content::htmlString() (#44703)

##Fix

Fix model:show register getAttribute() as a null accessor (#44683)
  • Fix the expectation of output assertions in PendingCommand (#44723)

v9.36.4

Added

Added primitive values ​​to the database query builder (and as a wrapper eloquent) (#44631)
  • Add TransactionCommitting (#44608)
  • Add dontIncludeSource to CliDumper and HtmlDumper (#44623)
  • Add
  • Illuminate/Filesystem/FilesystemAdapter::checksum()
  • (#44660)Add handlers for silent discard and missing attribute conflicts (#44664)
##Restore

Restore "Allow using MustVerifyEmail as primary key on models without ids" (#44672)

Changes

Created on clone request New Json parameter pack instance (#44671)

    Prevent provider from starting when running env:decrypt (#44654)

v9. 36.3

Restore

  • Micro-optimization of restore view event (#44653)

Fixation

  • Fixed sidebar tab, clear view cache view:clear (#44643)
  • FixedIlluminate/Database/Eloquent/Model::offsetExists() (#44642)
  • Ignore factory between component's cache and test(#44648)

Change

  • Bump Testbench dependency(# 44651)

##v9.36.2

Fix

    Make sure to * Call view creators and compositors when present (#44636)

v9.36.1

Repair

    Fix the livewire component (#pull) using createBladeViewFromString
Original address: https://laravel-news.com/laravel-9-37 -0

Translation 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!

Statement:
This article is reproduced at:learnku.com. If there is any infringement, please contact admin@php.cn delete