Add application API and OpenAPI docs
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Actions\Projects;
|
||||
|
||||
use App\Http\Resources\TicketStatusResource;
|
||||
use App\Models\Ticket;
|
||||
|
||||
class BuildProjectTicketStatusTargetsPayload
|
||||
{
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function handle(Ticket $ticket): array
|
||||
{
|
||||
$ticket->loadMissing('ticketStatus.allowedTargetStatuses.boardColumn');
|
||||
|
||||
return [
|
||||
'current_status' => $ticket->ticketStatus === null
|
||||
? null
|
||||
: TicketStatusResource::make($ticket->ticketStatus->loadMissing('boardColumn'))->resolve(),
|
||||
'target_statuses' => TicketStatusResource::collection(
|
||||
$ticket->ticketStatus?->allowedTargetStatuses ?? collect(),
|
||||
)->resolve(),
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user