Files
portal-api/app/Http/Resources/Api/Client/Ticket/ClientTicketReplyResource.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

23 lines
690 B
PHP

<?php
namespace App\Http\Resources\Api\Client\Ticket;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;
class ClientTicketReplyResource extends JsonResource
{
public function toArray(Request $request): array
{
$fromStaff = $this->user_id !== null;
return [
'message' => $this->message,
'sender_type' => $fromStaff ? 'staff' : 'client',
'sender_name' => $fromStaff ? (optional($this->user)->name ?: 'Nhân viên hỗ trợ') : 'Khách hàng',
'sender_role' => $fromStaff ? 'Nhân viên hỗ trợ' : 'Khách hàng',
'created_at' => $this->created_at,
];
}
}