41 lines
1.2 KiB
PHP
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,
|
|
);
|
|
}
|
|
}
|