feat: create PostCategoryFactory for generating post category data feat: create PostFactory for generating post data feat: add retry_requested_at column to services table feat: add vcenter provisioning fields to products table feat: add module_host_id to os table feat: create email_notification_templates table for email templates feat: add scenario and format fields to template table feat: add admin fields to transactions table fix: update ticket table columns and types feat: add uuid to ticket table and backfill existing records fix: make ticket_reply user_id nullable feat: create notifications table for user notifications fix: make ticket uuid nullable feat: create post_categories table for blog categories feat: create posts table for blog posts feat: add invoice email template for PDF generation
30 lines
968 B
PHP
30 lines
968 B
PHP
<?php
|
|
|
|
namespace App\Http\Resources\Api\Ticket;
|
|
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
|
|
class TicketReplyResource extends JsonResource
|
|
{
|
|
public function toArray(Request $request): array
|
|
{
|
|
return [
|
|
'id' => $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,
|
|
];
|
|
}
|
|
}
|