42 lines
1.1 KiB
PHP
42 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Jobs\Mail\Customer;
|
|
|
|
use App\Mail\Customer\VMCreationFailed;
|
|
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 VMCreationFailedJob implements ShouldQueue
|
|
{
|
|
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
|
|
|
public array $data;
|
|
|
|
/**
|
|
* Create a new job instance.
|
|
*/
|
|
public function __construct(array $data)
|
|
{
|
|
$this->data = $data;
|
|
}
|
|
|
|
/**
|
|
* Execute the job.
|
|
*/
|
|
public function handle(): void
|
|
{
|
|
try {
|
|
Mail::to($this->data['customer_email'])
|
|
->send(new VMCreationFailed($this->data));
|
|
} catch (\Throwable $e) {
|
|
\Log::error('Không thể gửi email thông báo lỗi VM: ' . $e->getMessage(), [
|
|
'customer_email' => $this->data['customer_email'],
|
|
'order_id' => $this->data['order_id'] ?? null
|
|
]);
|
|
}
|
|
}
|
|
}
|