Files
portal-api/app/Http/Resources/Api/Ticket/TicketResource.php
baodev0 0b08689ea4 feat: harden admin auth and ticket workflows
- add rotating admin refresh tokens and password gates\n- expand ticket galleries, exports, and client resources\n- improve IP allocation auditing and dashboard data\n- enforce encrypted client access tokens on public routes
2026-10-16 17:00:55 +07:00

36 lines
1.3 KiB
PHP

<?php
namespace App\Http\Resources\Api\Ticket;
use App\Support\TicketGallery;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;
class TicketResource extends JsonResource
{
public function toArray(Request $request): array
{
return [
'id' => $this->id,
'uuid' => $this->uuid,
'ticket_num' => $this->ticket_num,
'subject' => $this->subject,
'description' => $this->description,
'status' => $this->status,
'room' => $this->room,
'data' => $this->data ? (is_string($this->data) ? json_decode($this->data, true) : $this->data) : null,
'gallery' => TicketGallery::adminUrls($this->resource),
'customer_id' => $this->customer_id,
'customer' => $this->whenLoaded('customer', fn() => [
'id' => $this->customer->id,
'uuid' => $this->customer->uuid,
'fullname' => $this->customer->fullname,
'email' => $this->customer->email,
]),
'replies' => TicketReplyResource::collection($this->whenLoaded('reply')),
'created_at' => $this->created_at,
'updated_at' => $this->updated_at,
];
}
}