Let's get started quickly I found new things in Laravel 9.22 Released I wanted to share with you.
- Fluent file validation rule https://github.com/laravel/framework/pull/43271
File validation rule object that provides a fluent interface like the Password validation rule
// Before
$request->validate([
'file' => ['required', 'file', 'mimes:mp3,wav,aac', 'max:12287'],
'image' => ['required', 'file', 'image', 'min:2048', 'max:12287', Rule::dimensions()->maxWidth(1000)->maxHeight(500)],
]);
// After
$request->validate([
'file' => ['required', File::types(['mp3', 'wav', 'aac'])->smallerThan(12 * 1024)],
'image' => ['required', File::image()->atLeast(2 * 1024)->smallerThan(12 * 1024)->dimensions(Rule::dimensions()->maxWidth(1000)->maxHeight(500))],
]);
more details :-
https://laravel.com/docs/9.x/validation#validating-files
Improved Artisan serve command
https://github.com/laravel/framework/pull/43375Support for multiple hash algorithms in Filesystem
https://www.php.net/manual/en/function.hash-algos.php
File::hash($path)
// 196b0f14eba66e10fba74dbf9e99c22f => default md5
File::hash($path, 'sha256')
// 19c451aedfb24c338a9a2a5c31d553ed77e7cdefc655035f390176ac24066051
- Allow using backed enums as route parameters https://github.com/laravel/framework/pull/43294
$user = User::first();
$user->type;
route('user-type', $user->type);
- Improves console output when command not found https://github.com/laravel/framework/pull/43323
I hope you enjoyed with me and to learn more about this release visit the sources and search more. I adore you who search for everything new.
Source :- https://laravel-news.com/laravel-9-22-0
Source :- https://www.youtube.com/watch?v=qiJrRKPqo3k
Top comments (0)