- 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
23 lines
690 B
PHP
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,
|
|
];
|
|
}
|
|
}
|