DEV Community

Morcos Gad
Morcos Gad

Posted on • Updated on

New Things Added - Laravel 9.5 Released

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

Str:wrap('value')->wrap('"');
Str::of('value')->wrap('"');
str('value')->wrap('"');
// Outputs: "value"

Str:wrap('is', 'This ', ' me!');
Str::of('is')->wrap('This ', ' me!');
str('is')->wrap('This ', ' me!');
// Outputs: This is me!
Enter fullscreen mode Exit fullscreen mode

accepting callables in the Http::beforeSending() method instead of only invokable classes. Now, the following example will work instead of getting a "Call to member function __invoke() on array"

Image description

Http::baseUrl('https://api.example.org')
    ->beforeSending([ $this, 'prepareRequest' ])
    ->asJson()
    ->withoutVerifying();
Enter fullscreen mode Exit fullscreen mode
Before:
<span>{{ $user->cities->map(fn ($city) => $city->name.' ('.$city->state->name.')')->implode(', ') }}</span>

After:
<span>{{ $user->cities->implode(fn ($city) => $city->name.' ('.$city->state->name.')', ', ') }}</span>
Enter fullscreen mode Exit fullscreen mode
php artisan schedule:list
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-5-0
Source :- https://www.youtube.com/watch?v=IybDVyRkNRw

Top comments (0)