$this->id, 'ticket_id' => $this->ticket_id, 'message' => $this->message, 'sender_type' => $this->user_id ? 'staff' : 'client', 'sender_name' => $this->when( $this->user_id, fn() => optional($this->user)->username ?? optional($this->user)->name ?? 'Admin', 'Khách hàng' ), 'sender_role' => $this->user_id ? 'Nhân viên hỗ trợ' : 'Khách hàng', 'user_id' => $this->user_id, 'customer_id' => $this->customer_id, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at, ]; } }