Laravel 9.37 Released

Published on by

Laravel 9.37 Released image

The Laravel team released 9.37 this week along with a few patch releases between 9.37 and the release of Laravel 9.36. This week's releases added support for preloading assets with Vite, new strict violation handlers, verbose view caching CLI output, and more.

Verbose view caching

Andrew Brown contributed the ability to pass -v to the view:cache artisan command to output the directories the command is looking in and -vv to see every file the command caches.

php artisan view:cache -vv

Here's an example of what you'll see with a fresh install of Laravel 9.37:

Handlers for silently discarded and missing attributes

Aaron Francis contributed the ability to register handlers for "silently discarded" and "missing attributes" strict mode violations:

Model::handleMissingAttributeViolationUsing(
function ($model, $key) {
// ...
}
);
 
Model::handleDiscardedAttributeViolationUsing(
function ($model, $keys) {
// ...
}
);

Pass a closure for the rescue report param

@foremtehan contributed passing a callable as the $report parameter when using rescue() so you can conditionally report the error based on the boolean returned:

rescue(fn() => 'error', fn() => 'rescue', function(Throwable $e){
return $e instanceof SomeException;
});

Support preloading assets with Vite

Tim MacDonald contributed preloading of assets required for the current page load with Vite. It is now the default behavior for Laravel applications using Vite. The details of how this works is quite intricate, and I'd recommend reading the description of Pull Request #44096. Also, you can learn more about the general concepts behind preloading critical assets to improve loading speed.

Query builder raw value method

@eusonlito contributed a rawValue() method to get a value from a SQL expression. Here are some examples from the pull request:

$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 see the complete list of new features and updates below and the diff between 9.36.0 and 9.37.0 on GitHub. The following release notes are directly from the changelog:

v9.37.0

Added

  • Added optional verbose output when view caching (#44673)
  • Allow passing closure to rescue $report parameter (#44710)
  • Support preloading assets with Vite (#44096)
  • Added Illuminate/Mail/Mailables/Content::htmlString() (#44703)

Fixed

  • Fixed model:show registering getAttribute() as a null accessor (#44683)
  • Fix expectations for output assertions in PendingCommand (#44723)

v9.36.4

Added

  • Added rawValue to Database Query Builder (and Eloquent as wrapper) (#44631)
  • Added TransactionCommitting (#44608)
  • Added dontIncludeSource to CliDumper and HtmlDumper (#44623)
  • Added Illuminate/Filesystem/FilesystemAdapter::checksum() (#44660)
  • Added handlers for silently discarded and missing attribute violations (#44664)

Reverted

Changed

  • Create new Json ParameterBag Instance when cloning Request (#44671)
  • Prevents booting providers when running env:decrypt (#44654)

v9.36.3

Reverted

  • Reverts micro-optimization on view events (#44653)

Fixed

  • Fixes blade not forgetting compiled views on view:clear (#44643)
  • Fixed Illuminate/Database/Eloquent/Model::offsetExists() (#44642)
  • Forget component's cache and factory between tests (#44648)

Changed

  • Bump Testbench dependencies (#44651)

v9.36.2

Fixed

  • Ensures view creators and composers are called when * is present (#44636)

v9.36.1

Fixed

  • Fixes livewire components that were using createBladeViewFromString (#pull)
Paul Redmond photo

Staff writer at Laravel News. Full stack web developer and author.

Cube

Laravel Newsletter

Join 40k+ other developers and never miss out on new tips, tutorials, and more.

image
Laravel Forge

Easily create and manage your servers and deploy your Laravel applications in seconds.

Visit Laravel Forge
Laravel Forge logo

Laravel Forge

Easily create and manage your servers and deploy your Laravel applications in seconds.

Laravel Forge
Tinkerwell logo

Tinkerwell

The must-have code runner for Laravel developers. Tinker with AI, autocompletion and instant feedback on local and production environments.

Tinkerwell
No Compromises logo

No Compromises

Joel and Aaron, the two seasoned devs from the No Compromises podcast, are now available to hire for your Laravel project. ⬧ Flat rate of $7500/mo. ⬧ No lengthy sales process. ⬧ No contracts. ⬧ 100% money back guarantee.

No Compromises
Kirschbaum logo

Kirschbaum

Providing innovation and stability to ensure your web application succeeds.

Kirschbaum
Shift logo

Shift

Running an old Laravel version? Instant, automated Laravel upgrades and code modernization to keep your applications fresh.

Shift
Bacancy logo

Bacancy

Supercharge your project with a seasoned Laravel developer with 4-6 years of experience for just $2500/month. Get 160 hours of dedicated expertise & a risk-free 15-day trial. Schedule a call now!

Bacancy
Lucky Media logo

Lucky Media

Bespoke software solutions built for your business. We ♥ Laravel

Lucky Media
Lunar: Laravel E-Commerce logo

Lunar: Laravel E-Commerce

E-Commerce for Laravel. An open-source package that brings the power of modern headless e-commerce functionality to Laravel.

Lunar: Laravel E-Commerce
LaraJobs logo

LaraJobs

The official Laravel job board

LaraJobs
Larafast: Laravel SaaS Starter Kit logo

Larafast: Laravel SaaS Starter Kit

Larafast is a Laravel SaaS Starter Kit with ready-to-go features for Payments, Auth, Admin, Blog, SEO, and beautiful themes. Available with VILT and TALL stacks.

Larafast: Laravel SaaS Starter Kit
SaaSykit: Laravel SaaS Starter Kit logo

SaaSykit: Laravel SaaS Starter Kit

SaaSykit is a Laravel SaaS Starter Kit that comes with all features required to run a modern SaaS. Payments, Beautiful Checkout, Admin Panel, User dashboard, Auth, Ready Components, Stats, Blog, Docs and more.

SaaSykit: Laravel SaaS Starter Kit
Rector logo

Rector

Your partner for seamless Laravel upgrades, cutting costs, and accelerating innovation for successful companies

Rector

The latest

View all →
Apply Dynamic Filters to Eloquent Models with the Filterable Package image

Apply Dynamic Filters to Eloquent Models with the Filterable Package

Read article
Property Hooks Get Closer to Becoming a Reality in PHP 8.4 image

Property Hooks Get Closer to Becoming a Reality in PHP 8.4

Read article
Asserting Exceptions in Laravel Tests image

Asserting Exceptions in Laravel Tests

Read article
Reversible Form Prompts and a New Exceptions Facade in Laravel 11.4 image

Reversible Form Prompts and a New Exceptions Facade in Laravel 11.4

Read article
Basset is an alternative way to load CSS & JS assets image

Basset is an alternative way to load CSS & JS assets

Read article
Integrate Laravel with Stripe Connect Using This Package image

Integrate Laravel with Stripe Connect Using This Package

Read article