Files
KanbanGit/app/Actions/Notifications/BuildTicketStatusChangedPayload.php
T
Koda 61505ace23
linter / quality (pull_request) Successful in 1m17s
tests / ci (8.4) (pull_request) Failing after 1m35s
Refactor notification event payloads and listener naming
2026-04-25 21:54:42 +00:00

41 lines
1.2 KiB
PHP

<?php
namespace App\Actions\Notifications;
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(
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,
);
}
}