Laravel 9.26 Released

Admin   Laravel   425  2022-08-30 05:00:02

The Laravel team released 9.26 with a Vite asset helper, Closure support to dispatch conditionals, min and max digit validation rules, and more:

Vite asset URL helper

Tim MacDonald contributed a Vite asset URL helper to generate a URL in Blade. Given the following code in your app's JS entrypoint, Vite will process all images and fonts in these paths:

2 '../images/**',
3 '../fonts/**',

Now, using the Vite asset helper method, it will point to your project's build assets within a blade template:

1<img src="{{ Vite::asset('resources/images/logo.jpeg') }}">
3{{-- <img src=""> --}}

See Processing Static Assets With Vite in the Vite documentation for further details.

Add Closure support to dispatch conditionals

@Italo contributed the usage of a Closure to dispatch jobs conditionally. The entire job instance is passed to the closure:

1// Dispatches job
3 fn ($job) => true,
4 $name
7// Will not dispatch
9 fn ($job) => false,
10 $name

Min and max digits validation

Dan Harrin contributed min_digits and max_digits built-in validation rules. These rules require the integer under validation must have a minimum or maximum length of value:

2 'number' => 1000,
3], [
4 'number' => [
5 // Passes as `1000` has 4 digits
6 'min_digits:3', 'max_digits:5',
7 // Fails as `1000` is greater than 5
8 'min:3', 'max:5',
9 ],

Added support for additional "where" methods in route groups

Ollie Read contributed support for all remaining where* methods available on routes to route groups:

1Route::whereIn(['foo', 'bar'], ['one', 'two'])
2 ->prefix('/{foo}/{bar}')
3 ->group(function () {
4 // ...
5 });

Release Notes

You can see the complete list of new features and updates below and the diff between 9.25.0 and 9.26.0 on GitHub.