DEV Community

Morcos Gad
Morcos Gad

Posted on • Edited on

New Things Added - Laravel 9.13 Released

Let's get started quickly I found new things in Laravel 9.13 Released I wanted to share with you.

method to the Collection class, which gets a single key's value from the first matching item in the collection

$c = new $collection([ ['id' => 1, 'name' => 'Hello'], ['id' => 2, 'name' => 'World'] ]); $this->assertEquals('Hello', $c->value('name')); $this->assertEquals('World', $c->where('id', 2)->value('name')); 
Enter fullscreen mode Exit fullscreen mode
  • Array map() Method
$data = ['first' => 'taylor', 'last' => 'otwell']; $mapped = Arr::map($data, function ($value, $key) { return $key.'-'.strrev($value); }); 
Enter fullscreen mode Exit fullscreen mode
  • Test Response collect() Method

collect() method to the TestResponse class to get the JSON-decoded body of the response as a collection

$response->collect(); /* Given the following array of data for a JSON response [ 'foo' => ['foobar_foo' => 'foo', 'foobar_bar' => 'bar'], ... ]; */ $response->collect('foo') // Returns a collection instance with: // ['foobar_foo' => 'foo', 'foobar_bar' => 'bar'] 
Enter fullscreen mode Exit fullscreen mode
$this->getJson('/users/1') ->assertOk() ->assertJsonMissingPath('email'); // Never return the user email $this->getJson('/articles') ->assertOk() ->assertJsonMissingPath('data.0.internalTags'); 
Enter fullscreen mode Exit fullscreen mode
Notification::assertCount(4) // any number  
Enter fullscreen mode Exit fullscreen mode

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-13-0
Source :- https://www.youtube.com/watch?v=8BVnn0qezM8

Top comments (0)