Add ticket status changed notification dispatch

This commit is contained in:
Eric Peters
2026-04-20 22:50:22 +02:00
parent ee15efe739
commit 71f07a8f7b
8 changed files with 417 additions and 0 deletions
@@ -0,0 +1,42 @@
<?php
namespace App\Actions\Notifications;
use App\Enums\NotificationEventType;
use App\Models\Project;
use App\Models\Ticket;
use App\Models\TicketStatus;
use App\Models\User;
use Carbon\CarbonImmutable;
class BuildTicketStatusChangedPayload
{
public function handle(
Project $project,
Ticket $ticket,
?User $actor,
int $originStatusId,
string $originLabel,
TicketStatus $destinationStatus,
string $destinationLabel,
CarbonImmutable $occurredAt,
): TicketStatusChangedPayload {
return new TicketStatusChangedPayload(
eventType: NotificationEventType::TicketStatusChanged,
projectId: $project->id,
projectKey: $project->key,
projectName: $project->name,
ticketId: $ticket->id,
ticketKey: $ticket->ticket_key,
ticketTitle: $ticket->title,
ticketUrl: route('projects.tickets.show', [$project, $ticket]),
actorId: $actor?->id,
actorName: $actor?->name,
fromStatusId: $originStatusId,
fromStatusLabel: $originLabel,
toStatusId: $destinationStatus->id,
toStatusLabel: $destinationLabel,
occurredAt: $occurredAt,
);
}
}