|
- <?php
-
- namespace App\Jobs\Email;
-
- use App\Codes\QueueName;
- use App\Email\Sender;
- use App\Models\Email;
- use Illuminate\Bus\Queueable;
- use Illuminate\Contracts\Queue\ShouldQueue;
- use Illuminate\Foundation\Bus\Dispatchable;
- use Illuminate\Queue\InteractsWithQueue;
- use Illuminate\Queue\SerializesModels;
-
- class SimpleEmail implements ShouldQueue
- {
- use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
-
- private string $emailId;
-
- /**
- * Create a new job instance.
- *
- * @return void
- */
- public function __construct(Email $email)
- {
- $this->emailId = $email->id;
- $this->onQueue(QueueName::EMAIL->value);
- }
-
- /**
- * Execute the job.
- *
- * @return void
- */
- public function handle()
- {
- Sender::send($this->emailId);
- }
- }
|