<?php

namespace App\Http\Resources;

use Illuminate\Http\Resources\Json\JsonResource;

class SavingResource extends JsonResource
{
   
    public function toArray($request)
    {
        return [
            'id'                    => $this->id,
            'client_name'           => $this->client->name,
            'client_code'           => $this->client->code,
            'village_kh'            => $this->client->village->name_km??'',
            'client_id'             => $this->client_id,
            'co_name'               => $this->co->name,
            'installment_date'      => $this->loan->installment_date??'',
            'loan_code'             => $this->loan->loan_code??'',
            'total_saving'          => $this->loan->total_risk??'',
            'loan_status_id'        => $this->loan->loan_status_id??'',
            'paid_saving'           => $this->paid_saving,
            'percent'               => $this->percent,
            'amount'                => $this->amount,
            'status_pay'            => $this->status_pay,
            'date_approved'         => $this->date_approved,
            'status'                => $this->status,
            'closing_date'          => $this->closing_date,


        ];
    }
}
