mail message sending delay
This commit is contained in:
1 parent
1963d6fcce
commit
dae8336ac9
2 files changed
+15
-3
No files matched your search
@@ -13,12 +13,15 @@ class SendNewsletterJob implements ShouldQueue
|
||||
|
||||
public $data;
|
||||
|
||||
public $delay;
|
||||
|
||||
/**
|
||||
* Create a new job instance.
|
||||
*/
|
||||
public function __construct($data)
|
||||
public function __construct($data, $delay = 0)
|
||||
{
|
||||
$this->data = $data;
|
||||
$this->delay = $delay;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -27,6 +30,9 @@ class SendNewsletterJob implements ShouldQueue
|
||||
*/
|
||||
public function handle(): void
|
||||
{
|
||||
Mail::to($this->data['email'])->send(new Newsletter($this->data));
|
||||
// Mail::to($this->data['email'])->send(new Newsletter($this->data));
|
||||
|
||||
Mail::to($this->data['email'])->later(now()->addSeconds($this->delay), new Newsletter($this->data));
|
||||
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user