find($this->mailboxId); if (! $mailbox) { return; } $hostingAccountId = $mailbox->hosting_account_id; try { if ($provisioner->isConfigured()) { $provisioner->deactivateMailbox($mailbox); } } catch (\Throwable $exception) { $mailbox->update(['status' => 'failed']); Log::error('DeactivateMailboxJob: Remote deactivation failed', [ 'mailbox_id' => $mailbox->id, 'address' => $mailbox->address, 'error' => $exception->getMessage(), ]); throw $exception; } $mailbox->delete(); if ($hostingAccountId) { $account = HostingAccount::query()->with(['product'])->find($hostingAccountId); if ($account) { $hostingMailboxes->syncAddonInvoice($account); } } } }