Sunday, May 19, 2024
HomePHPLaravel 9.26 Launched | Laravel Information

Laravel 9.26 Launched | Laravel Information


The Laravel workforce launched 9.26 with a Vite asset helper, Closure help to dispatch conditionals, min and max digit validation guidelines, and extra:

Vite asset URL helper

Tim MacDonald contributed a Vite asset URL helper to generate a URL in Blade. Given the next code in your app’s JS entrypoint, Vite will course of all pictures and fonts in these paths:

1import.meta.glob([

2 '../images/**',

3 '../fonts/**',

4]);

Now, utilizing the Vite asset helper methodology, it should level to your challenge’s construct belongings inside a blade template:

1<img src="{{ Vite::asset('sources/pictures/emblem.jpeg') }}">

2 

3{{-- <img src="http://asset-url.com/construct/belongings/emblem.1ddf943b.jpeg"> --}}

See Processing Static Belongings With Vite within the Vite documentation for additional particulars.

Add Closure help to dispatch conditionals

@Italo contributed the utilization of a Closure to dispatch jobs conditionally. Your complete job occasion is handed to the closure:

1// Dispatches job

2MyQueuableJob::dispatchIf(

3 fn ($job) => true,

4 $title

5);

6 

7// Is not going to dispatch

8MyQueuableJob::dispatchUnless(

9 fn ($job) => false,

10 $title

11);

Min and max digits validation

Dan Harrin contributed min_digits and max_digits built-in validation guidelines. These guidelines require the integer beneath validation will need to have a minimal or most size of worth:

1Validator::validate([

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 ],

10])

Added help for added “the place” strategies in route teams

Ollie Learn contributed help for all remaining the place* strategies accessible on routes to route teams:

1Route::whereIn(['foo', 'bar'], ['one', 'two'])

2 ->prefix('/{foo}/{bar}')

3 ->group(perform () {

4 // ...

5 });

Launch Notes

You possibly can see the whole checklist of recent options and updates beneath and the diff between 9.25.0 and 9.26.0 on GitHub.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments