DEV Community

Morcos Gad
Morcos Gad

Posted on • Updated on

New Things Added - Laravel 9.12 Released

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

method to the HTTP client that will throw an exception if the condition evaluates to true

// Throws RequestException
return Http::baseUrl('https://foo.bar')
       ->throwIf(true)
       ->get('not-found');

// Doesn't throw
return Http::baseUrl('https://foo.bar')
       ->throwIf(false)
       ->get('not-found');
Enter fullscreen mode Exit fullscreen mode

You can pass an array to the delay method to specify the delay amount for specific channels

$user->notify((new InvoicePaid($invoice))->delay([
    'mail' => now()->addMinutes(5),
    'sms' => now()->addMinutes(10),
]));
Enter fullscreen mode Exit fullscreen mode

You can also define a withDelay method on the notification class

/**
 * Determine the notification's delivery delay.
 *
 * @param  mixed  $notifiable
 * @return array
 */
public function withDelay($notifiable)
{
    return [
        'mail' => now()->addMinutes(5),
        'sms' => now()->addMinutes(10),
    ];
}
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-12-0
Source :- https://www.youtube.com/watch?v=NyI9GNI8MlI

Latest comments (0)