<?php

namespace App\Http\Resources;

use App\Models\Loan;
use Illuminate\Http\Resources\Json\JsonResource;

class ClientCustomResource extends JsonResource
{
    public function toArray($request)
    {
        return [
            'id'               => encrypt_id($this->id),
            'code'             => $this->code,
            'branch_id'        => $this->branch_id,
            'name'             => $this->name,
            'name_en'          => $this->name_en,
            'gender'           => $this->gender,
            'phone'            => $this->phone,
            'type_document'    => $this->type_document,
            'id_card'          => $this->id_card,
            'accommodation'    => $this->accommodation,
            'link_map_house'   => $this->link_map_house,
            'link_map_business'=> $this->link_map_business,
            // 'photo'            => $this->photo == null ? 'uploads/clients/default.png' : $this->photo,
            'branch_name'      => $this->branchs->name_km??'',
        ];

    }
}
