Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 12 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
| DeactivateUserNotification | |
0.00% |
0 / 12 |
|
0.00% |
0 / 2 |
12 | |
0.00% |
0 / 1 |
| __construct | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| handle | |
0.00% |
0 / 11 |
|
0.00% |
0 / 1 |
6 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace App\Jobs\Emails; |
| 4 | |
| 5 | use App\Http\Models\Parameter; |
| 6 | use App\Mail\AdminCenterDeactivateUserNotification; |
| 7 | use App\Services\Email\EmailService; |
| 8 | use Illuminate\Bus\Queueable; |
| 9 | use Illuminate\Contracts\Queue\ShouldQueue; |
| 10 | use Illuminate\Foundation\Bus\Dispatchable; |
| 11 | use Illuminate\Queue\InteractsWithQueue; |
| 12 | use Illuminate\Queue\SerializesModels; |
| 13 | |
| 14 | class DeactivateUserNotification implements ShouldQueue |
| 15 | { |
| 16 | use Dispatchable, InteractsWithQueue, Queueable, SerializesModels; |
| 17 | |
| 18 | public $tries = 3; |
| 19 | public $retryAfter = 60; |
| 20 | |
| 21 | /** |
| 22 | * Create a new job instance. |
| 23 | */ |
| 24 | public function __construct( |
| 25 | private readonly string $email, |
| 26 | private readonly string $companyEmail, |
| 27 | private readonly string $companyName, |
| 28 | private readonly EmailService $emailService |
| 29 | ) { |
| 30 | // |
| 31 | } |
| 32 | |
| 33 | /** |
| 34 | * Execute the job. |
| 35 | */ |
| 36 | public function handle(): void |
| 37 | { |
| 38 | $supportEmailList = Parameter::where('name', 'support_emails')->first(); |
| 39 | |
| 40 | foreach ($supportEmailList->value as $email) { |
| 41 | $this->emailService->send( |
| 42 | $email, |
| 43 | new AdminCenterDeactivateUserNotification( |
| 44 | email: $this->email, |
| 45 | companyEmail: $this->companyEmail, |
| 46 | companyName: $this->companyName |
| 47 | ), |
| 48 | 'cac_deactivate_user_notification' |
| 49 | ); |
| 50 | } |
| 51 | } |
| 52 | } |