53 lines
1.4 KiB
PHP
53 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace App\Jobs;
|
|
|
|
use App\Mail\ReservationCancelledMail;
|
|
use Cog\Contracts\Love\Reaction\Models\Reaction;
|
|
use Illuminate\Bus\Queueable;
|
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
use Illuminate\Foundation\Bus\Dispatchable;
|
|
use Illuminate\Queue\InteractsWithQueue;
|
|
use Illuminate\Queue\SerializesModels;
|
|
use Illuminate\Support\Facades\Mail;
|
|
|
|
class SendReservationCancelledMail implements ShouldQueue
|
|
{
|
|
use Dispatchable;
|
|
use InteractsWithQueue;
|
|
use Queueable;
|
|
use SerializesModels;
|
|
|
|
public $tries = 3;
|
|
public $backoff = [5,30,300]; // wait for 5, 30, or 300 sec before worker tries again
|
|
public $data;
|
|
|
|
/**
|
|
* Create a new job instance.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function __construct($data)
|
|
{
|
|
$this->data = $data;
|
|
}
|
|
|
|
/**
|
|
* Execute the job.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function handle()
|
|
{
|
|
\Log::info('SendReservationCancelledMail: Starting to process job', [
|
|
'reacter_email' => $this->data['reacter_email'],
|
|
'post_id' => $this->data['post_id']
|
|
]);
|
|
|
|
// Send the email to the reacter (person who cancelled the reservation)
|
|
Mail::to($this->data['reacter_email'])->send(new ReservationCancelledMail($this->data));
|
|
|
|
\Log::info('SendReservationCancelledMail: Email sent successfully', ['to' => $this->data['reacter_email']]);
|
|
}
|
|
}
|