%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /var/www/html/klinisol/klinisol-api/app/Transformers/App/
Upload File :
Create Path :
Current File : /var/www/html/klinisol/klinisol-api/app/Transformers/App/ChatRoomTransformer.php

<?php

namespace App\Transformers\App;

use App\Models\ChatRoom;
use App\Transformers\BaseTransformer;
use App\Transformers\ProtocolTransformer;

class ChatRoomTransformer extends BaseTransformer
{
    protected $availableIncludes = [
        'patient',
        'protocol',
    ];

    public function includePatient(ChatRoom $chatRoom)
    {
        return $this->item($chatRoom->patient, new \App\Transformers\PatientTransformer(), 'patient');
    }

    public function includeProtocol(ChatRoom $chatRoom)
    {
        return $this->item($chatRoom->protocol, new ProtocolTransformer(), 'protocol');
    }

    protected $defaultIncludes = [
        'patient',
        'protocol',
    ];

    public function transform(ChatRoom $chatRoom)
    {
        return [
            'id'          => $chatRoom->id,
            'patient_id'  => $chatRoom->patient_id,
            'protocol_id' => $chatRoom->protocol_id,
            'sid'         => $chatRoom->sid,
            'room'        => $chatRoom->name,
            'status'      => $chatRoom->status,
            'finished_at' => $chatRoom->finished_at,
            'has_video'   => $chatRoom->has_video,
        ];
    }
}

Zerion Mini Shell 1.0