first(); $settingValue = $setting ? json_decode((string) $setting->value, true) : []; $adminEmail = $settingValue['admin_email'] ?? null; if (empty($adminEmail)) { Log::warning('HostingAccountCreatedAdminNotificationJob: admin_email not configured in settings.'); return; } $payload = array_merge($this->data, [ 'company_name' => $settingValue['company'] ?? 'Portal Admin', ]); try { Mail::to($adminEmail)->send(new HostingAccountCreatedAdminNotification($payload)); } catch (\Throwable $e) { Log::error('HostingAccountCreatedAdminNotificationJob: failed to send email. ' . $e->getMessage(), [ 'admin_email' => $adminEmail, 'domain_name' => $this->data['domain_name'] ?? null, ]); } } public function failed(\Throwable $e): void { Log::error('HostingAccountCreatedAdminNotificationJob: job failed.', [ 'error' => $e->getMessage(), 'domain_name' => $this->data['domain_name'] ?? null, ]); } }