Let's get started quickly I found new things in Laravel 9.10 , 9.11 Released I wanted to share with you.
- Before Refreshing Database Function Run code before the database starts refreshing
class DataExportTest extends TestCase { use RefreshDatabase; protected $seed = true; protected function beforeRefreshingDatabase() { $this->artisan('db:wipe --database another-database-connection'); } // ... }
- Eloquent "findOr" Method https://github.com/laravel/framework/pull/42092
User::findOr(1, fn () => throw new RuntimeException); User::findOr(1, fn () => abort(403)); User::findOr(1, fn () => 'return something'); User::findOr(1, ['columns'], fn () => '...'); // Also works with relations $user->posts()->findOr(1, fn () => '...');
- Retrieve Input from the Request as Stringable https://github.com/laravel/framework/commit/c9d34b7be0611d26f3e46669934cf542cc5e9e21
$name = $request->string('name'); // or $name = $request->str('name');
- Add doesntExpectOutputToContain assertion method https://github.com/laravel/framework/pull/42096
Artisan::command('contains', function () { $this->line('My name is Taylor Otwell'); }); $this->artisan('contains') ->doesntExpectOutputToContain('Taylor Otwell') // false
- Add Arr::join() Method https://github.com/laravel/framework/pull/42197
$stack = ['Tailwind', 'Alpine', 'Laravel', 'Livewire']; Arr::join($stack, ', ', ' and '); // Tailwind, Alpine, Laravel and Livewire Arr::join($stack, ', ', ', and '); // Tailwind, Alpine, Laravel, and Livewire
- Methods to Check the Existence of Validated Input Data https://github.com/laravel/framework/pull/42184
$validatedName = $request->safe()->has('name'); // True $validatedAge = $request->safe()->has('age'); // False $validatedName = $request->safe()->missing('name'); // False $validatedAge = $request->safe()->missing('age'); // True // Check each key in the array $validatedName = $request->safe()->has(['name', 'age']);
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-10-0
Source :- https://www.youtube.com/watch?v=vO-uRGPtlP0
Source :- https://laravel-news.com/laravel-9-11-0
Source :- https://www.youtube.com/watch?v=uViQgxDZi1M
Top comments (0)