HEX
Server: nginx/1.24.0
System: Linux DGT-WORDPRESS-VM-SERVER 6.14.0-1017-azure #17~24.04.1-Ubuntu SMP Mon Dec 1 20:10:50 UTC 2025 x86_64
User: ubuntu (1000)
PHP: 8.4.12
Disabled: NONE
Upload Files
File: /mnt/data/ghayatcom/ghayatcom-api/app/Http/Resources/ChatResource.php
<?php

namespace App\Http\Resources;

use Illuminate\Http\Resources\Json\JsonResource;

/**
 * App\Http\Resources
 *
 * @property int $id
 * @property int $appointment_id
 * @property int $sender_id
 * @property int $recipient_id
 * @property mixed $message
 * @property mixed $created_at
 * @property object $sender
 * @property string $getUserAttachment
 * @property string $getFileAttach
 * @property object $recipient
 * @method string getUserAttachment()
 * @method string getFileAttach()
 */
class ChatResource extends JsonResource
{
    /**
     * Transform the resource into an array.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return array
     */
    public function toArray($request)
    {
        $RandomLibrary = new \App\Library\RandomLibrary;

        return [
            'id' => $this->id,
            'appointment_id' => $this->appointment_id,
            'sender_id' => $this->sender_id,
            'sender_name' => trim($this->sender->first_name.' '.$this->sender->last_name),
            'sender_image' => $this->sender->profile_image,
            'recipient_id' => $this->recipient_id,
            'recipient_name' => trim($this->recipient->first_name.' '.$this->recipient->last_name),
            'recipient_image' => $this->recipient->profile_image,
            'message' => $this->message,
            'file_path' => $this->getUserAttachment(),
            'file_attach' => $this->getFileAttach(),
            'created_at' => $this->created_at,
        ];
    }
}