32 lines
589 B
PHP
32 lines
589 B
PHP
<?php
|
|
|
|
namespace App\Jobs;
|
|
|
|
use App\Mail\Newsletter;
|
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
use Illuminate\Foundation\Queue\Queueable;
|
|
use Illuminate\Support\Facades\Mail;
|
|
|
|
class SendNewsletterJob implements ShouldQueue
|
|
{
|
|
use Queueable;
|
|
|
|
public $mail_data;
|
|
|
|
/**
|
|
* Create a new job instance.
|
|
*/
|
|
public function __construct($mail_data)
|
|
{
|
|
$this->mail_data = $mail_data;
|
|
}
|
|
|
|
/**
|
|
* Execute the job.
|
|
*/
|
|
public function handle(): void
|
|
{
|
|
Mail::to($this->mail_data->email)->send(new Newsletter($this->mail_data));
|
|
}
|
|
}
|