Arash
Arash

Reputation: 689

How to set Max Attempts For Queued Notifications in Laravel

In laravel queue system when working with jobs I can set max tries for each job with adding a public field $tries = n in job class itself is it possible and How to do the same thing in notification implementing shouldQueue ?

Upvotes: 4

Views: 2342

Answers (1)

Michail Strokin
Michail Strokin

Reputation: 541

It is possible in Laravel 5.7.14: https://github.com/laravel/framework/pull/26493

use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;
use Illuminate\Contracts\Queue\ShouldQueue;

class TestNotification extends Notification implements ShouldQueue
{
    use Queueable;
    public $tries = 3; // Max tries

    public $timeout = 15; // Timeout seconds
 }

Upvotes: 6

Related Questions