data = $data; } public function handle(): void { if (empty($this->data['customer_email'])) { Log::warning('HostingAccountCreatedJob: missing customer_email, skipped.', [ 'domain_name' => $this->data['domain_name'] ?? null, ]); return; } try { $invoice = app(InvoicePdfService::class)->attachment($this->data['invoice_id'] ?? null); Mail::to($this->data['customer_email']) ->send(new HostingAccountCreated($this->data, $invoice['pdf'] ?? null, $invoice['file_name'] ?? null)); } catch (\Throwable $e) { Log::error('Không thể gửi email thông báo khởi tạo hosting: ' . $e->getMessage(), [ 'customer_email' => $this->data['customer_email'] ?? null, 'domain_name' => $this->data['domain_name'] ?? null, ]); } } public function failed(\Throwable $e): void { Log::error('HostingAccountCreatedJob: job failed.', [ 'error' => $e->getMessage(), 'domain_name' => $this->data['domain_name'] ?? null, ]); } }