1 | <?php |
||
2 | |||
3 | namespace App\Jobs; |
||
4 | |||
5 | use App\Http\Controllers\Common\PhpMailController; |
||
6 | use Illuminate\Bus\Queueable; |
||
7 | use Illuminate\Contracts\Queue\ShouldQueue; |
||
8 | use Illuminate\Foundation\Bus\Dispatchable; |
||
9 | use Illuminate\Queue\InteractsWithQueue; |
||
10 | use Illuminate\Queue\SerializesModels; |
||
11 | |||
12 | class SendEmail implements ShouldQueue |
||
13 | { |
||
14 | use Dispatchable, InteractsWithQueue, Queueable, SerializesModels; |
||
0 ignored issues
–
show
introduced
by
![]() |
|||
15 | |||
16 | public $tries = 5; |
||
17 | protected $from; |
||
18 | protected $to; |
||
19 | protected $template_data; |
||
20 | protected $template_name; |
||
21 | protected $replace; |
||
22 | protected $type; |
||
23 | protected $bcc; |
||
24 | |||
25 | /** |
||
26 | * Create a new job instance. |
||
27 | * |
||
28 | * @return void |
||
29 | */ |
||
30 | public function __construct($from, $to, $template_data, $template_name, $replace = [], $type = '', $bcc = []) |
||
31 | { |
||
32 | $this->from = $from; |
||
33 | $this->to = $to; |
||
34 | $this->template_data = $template_data; |
||
35 | $this->template_name = $template_name; |
||
36 | $this->replace = $replace; |
||
37 | $this->type = $type; |
||
38 | $this->bcc = $bcc; |
||
39 | } |
||
40 | |||
41 | /** |
||
42 | * Execute the job. |
||
43 | * |
||
44 | * @return void |
||
45 | */ |
||
46 | public function handle(PhpMailController $phpMailController) |
||
47 | { |
||
48 | $p = $phpMailController->mailing( |
||
49 | $this->from, |
||
50 | $this->to, |
||
51 | $this->template_data, |
||
52 | $this->template_name, |
||
53 | $this->replace, |
||
54 | $this->type, |
||
55 | $this->bcc |
||
56 | ); |
||
57 | |||
58 | return $p; |
||
59 | } |
||
60 | } |
||
61 |