*/ public function toArray(Request $request): array { return [ 'id' => $this->id, 'acceptance_criteria' => AcceptanceCriteriaChecklistMapper::fromModels( $this->relationLoaded('acceptanceCriteria') ? $this->acceptanceCriteria : $this->acceptanceCriteria()->get(), ), 'assignee' => $this->whenLoaded( 'assignee', fn (): ?array => $this->assignee === null ? null : UserResource::make($this->assignee)->resolve(), ), 'assignee_user_id' => $this->assignee_user_id, 'author' => $this->whenLoaded( 'author', fn (): ?array => $this->author === null ? null : UserResource::make($this->author)->resolve(), ), 'author_user_id' => $this->author_user_id, 'blocked_comment' => $this->blocked_comment, 'description' => $this->description, 'field_values' => $this->whenLoaded( 'fieldValues', fn (): array => TicketFieldValueResource::collection($this->fieldValues)->resolve(), ), 'is_blocked' => $this->is_blocked, 'parent_ticket_id' => $this->parent_ticket_id, 'project_id' => $this->project_id, 'sequence_number' => $this->sequence_number, 'story_points' => $this->story_points, 'ticket_key' => $this->ticket_key, 'ticket_priority' => $this->whenLoaded( 'ticketPriority', fn (): ?array => $this->ticketPriority === null ? null : TicketPriorityResource::make($this->ticketPriority)->resolve(), ), 'ticket_priority_id' => $this->ticket_priority_id, 'ticket_status' => $this->whenLoaded( 'ticketStatus', fn (): ?array => $this->ticketStatus === null ? null : TicketStatusResource::make($this->ticketStatus)->resolve(), ), 'ticket_status_id' => $this->ticket_status_id, 'ticket_type' => $this->whenLoaded( 'ticketType', fn (): ?array => $this->ticketType === null ? null : TicketTypeResource::make($this->ticketType)->resolve(), ), 'ticket_type_id' => $this->ticket_type_id, 'title' => $this->title, 'worklog_entries' => $this->whenLoaded( 'worklogEntries', fn (): array => TicketWorklogEntryResource::collection($this->worklogEntries)->resolve(), ), 'created_at' => $this->created_at?->toISOString(), 'updated_at' => $this->updated_at?->toISOString(), ]; } }