The Laravel workforce launched 9.45 this week with customized part search paths, a brand new validation rule, router comfort for ULID route params, and extra:
Customized part search paths
Taylor Otwell contributed the registration of root-level nameless part search paths. That is handy for tasks which have parts in numerous areas.
To configure a search path, add the next to the boot()
methodology inside a registered service supplier:
1
2Blade::anonymousComponentPath(__DIR__.'/../parts');
3// I.e., `<x-panel />`
4
5// With a prefixed namespace
6Blade::anonymousComponentPath(
7 __DIR__.'/../parts',
8 'dashboard'
9);
10
11// I.e., `<x-dashboard::panel />`
See theNameless Part Paths documentation for additional particulars.
Decimal validation rule
@Pusparaj contributed a decimal
validation rule with a min, max
configuration. Listed here are a number of examples from the pull request exams:
1// Passes validation
2$v = new Validator($trans, ['foo' => '1.234'], ['foo' => 'Decimal:2,3']);
3$this->assertTrue($v->passes());
4
5// Fails validation
6$v = new Validator($trans, ['foo' => '1.2345'], ['foo' => 'Decimal:2,3']);
7$this->assertFalse($v->passes());
Here is how the rule works:
-
decimal:2
is precisely two digits on the fractional half -
decimal:2,3
both two or three digits on the fractional half -
decimal:0,3
values should have at most three digits within the fractional half and may embrace zero digits (i.e., integer)
“whereUlid()” Route Help
Jamshed Javed contributed whereUlid()
route assist to the gathering of commonly-used common expressions. Given you desire a route id
param to match a ULID, you’d use the next now:
1Route::get('/person/{id}', perform ($id) {
2 //
3})->whereUlid('id');
Launch Notes
You possibly can see the whole listing of latest options and updates under and the diff between 9.44.0 and 9.45.0 on GitHub. The next launch notes are instantly from the changelog:
v9.45.0
Added
- Permits the registration of customized, root-level nameless part search paths. (#45338, 1ff0379)
- Added decimal validation rule (#45356, e89b2b0)
- Added align property to button mail part (#45362)
- Added whereUlid(param) assist for routing (#45372)
Mounted
- Mounted single line @php statements to not be parsed as php blocks in BladeCompiler (#45333)
- Added lacking code to set locale from mannequin most well-liked locale in Maillable (#45308)