49 lines
1.8 KiB
PHP
49 lines
1.8 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Resources\Ticket;
|
|
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
|
|
class TicketResource extends JsonResource
|
|
{
|
|
/**
|
|
* Transform the resource into an array.
|
|
*
|
|
* @return array<string, mixed>
|
|
*/
|
|
public function toArray(Request $request): array
|
|
{
|
|
return [
|
|
'id' => $this->id,
|
|
'ticket_no' => $this->ticket_no,
|
|
'ticket_type_id' => $this->ticket_type_id,
|
|
'customer_id' => $this->customer_id,
|
|
'title' => $this->title,
|
|
'description' => $this->description,
|
|
'priority' => $this->priority,
|
|
'status' => $this->status,
|
|
'source' => $this->source,
|
|
'installation_step' => $this->installation_step,
|
|
'verified_by' => $this->verified_by,
|
|
'verified_at' => $this->verified_at,
|
|
'verification_notes' => $this->verification_notes,
|
|
'created_by' => $this->created_by,
|
|
'created_at' => $this->created_at,
|
|
'updated_at' => $this->updated_at,
|
|
'tenant_id' => $this->tenant_id,
|
|
'sla_minutes' => $this->sla_minutes,
|
|
'assigned_at' => $this->assigned_at,
|
|
'resolved_at' => $this->resolved_at,
|
|
'closed_at' => $this->closed_at,
|
|
'ticket_type' => $this->whenLoaded('ticketType'),
|
|
'tenant' => $this->whenLoaded('tenant'),
|
|
'customer' => $this->whenLoaded('customer'),
|
|
'creator' => $this->whenLoaded('creator'),
|
|
'assignments' => $this->whenLoaded('assignments'),
|
|
'materials' => $this->whenLoaded('materials'),
|
|
'attachments' => $this->whenLoaded('attachments'),
|
|
];
|
|
}
|
|
}
|