coolify/app/Jobs/SendConfirmationForWaitlistJob.php

39 lines
1.4 KiB
PHP
Raw Normal View History

2023-08-15 14:11:38 +02:00
<?php
namespace App\Jobs;
use Illuminate\Bus\Queueable;
2023-09-14 10:12:44 +02:00
use Illuminate\Contracts\Queue\ShouldBeEncrypted;
2023-08-15 14:11:38 +02:00
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
2024-06-10 22:43:34 +02:00
class SendConfirmationForWaitlistJob implements ShouldBeEncrypted, ShouldQueue
2023-08-15 14:11:38 +02:00
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
2024-06-19 08:59:46 +02:00
public function __construct(public string $email, public string $uuid) {}
2023-08-15 14:11:38 +02:00
public function handle()
{
try {
2024-07-24 14:27:21 +02:00
$mail = new MailMessage;
2024-06-10 22:43:34 +02:00
$confirmation_url = base_url().'/webhooks/waitlist/confirm?email='.$this->email.'&confirmation_code='.$this->uuid;
$cancel_url = base_url().'/webhooks/waitlist/cancel?email='.$this->email.'&confirmation_code='.$this->uuid;
2023-08-15 14:11:38 +02:00
$mail->view('emails.waitlist-confirmation',
[
'confirmation_url' => $confirmation_url,
'cancel_url' => $cancel_url,
]);
$mail->subject('You are on the waitlist!');
send_user_an_email($mail, $this->email);
2023-09-11 17:36:30 +02:00
} catch (\Throwable $e) {
2024-06-10 22:43:34 +02:00
send_internal_notification("SendConfirmationForWaitlistJob failed for {$this->email} with error: ".$e->getMessage());
2023-09-11 17:36:30 +02:00
ray($e->getMessage());
throw $e;
2023-08-15 14:11:38 +02:00
}
}
}