new deployer command

This commit is contained in:
Mark Gregory
2026-09-16 13:22:16 +01:00
parent fac5df8cc3
commit 3410ab85fe
15 changed files with 26429 additions and 441 deletions
@@ -34,7 +34,7 @@ final class WorkflowNotificationService
$recipient = $this->recipient($template->to_role, $ticket, $actor);
if ($recipient === null || blank($recipient->email ?? null)) {
$this->log($template, $ticket, $event, null, 'skipped', 'No recipient email was available.');
$this->log($template, $ticket, $event, ['recipient' => null, 'status' => 'skipped', 'error' => 'No recipient email was available.']);
return;
}
@@ -56,10 +56,10 @@ final class WorkflowNotificationService
}
});
$this->log($template, $ticket, $event, (string) $recipient->email, 'sent', null, $subject, $trackingToken);
$this->log($template, $ticket, $event, ['recipient' => (string) $recipient->email, 'status' => 'sent', 'subject' => $subject, 'tracking_token' => $trackingToken]);
} catch (Throwable $exception) {
Log::warning('Helpdesk workflow email failed.', ['event' => $event, 'ticket_id' => $ticket->id, 'error' => $exception->getMessage()]);
$this->log($template, $ticket, $event, (string) $recipient->email, 'failed', $exception->getMessage(), $subject);
$this->log($template, $ticket, $event, ['recipient' => (string) $recipient->email, 'status' => 'failed', 'error' => $exception->getMessage(), 'subject' => $subject]);
}
});
}
@@ -157,17 +157,18 @@ final class WorkflowNotificationService
return '<img src="' . e($url) . '" width="1" height="1" alt="" style="display:none" />';
}
private function log(WorkflowTemplate $template, Ticket $ticket, string $event, ?string $recipient, string $status, ?string $error = null, ?string $subject = null, ?string $trackingToken = null): void
/** @param array{recipient:?string,status:string,error?:?string,subject?:?string,tracking_token?:?string} $details */
private function log(WorkflowTemplate $template, Ticket $ticket, string $event, array $details): void
{
WorkflowLog::query()->create([
'template_id' => $template->id,
'ticket_id' => $ticket->id,
'event' => $event,
'recipient' => $recipient,
'subject' => $subject,
'status' => $status,
'tracking_token' => $trackingToken,
'error' => $error,
'recipient' => $details['recipient'],
'subject' => $details['subject'] ?? null,
'status' => $details['status'],
'tracking_token' => $details['tracking_token'] ?? null,
'error' => $details['error'] ?? null,
]);
}
}