<?php

namespace App\Http\Resources;


use App\Models\ReciptVoucher;
use App\Models\ReciptVoucherDetails;
use App\Models\Sales;
use Illuminate\Http\Resources\Json\JsonResource;
use DB;
use Auth;

class ReciptVoucherDetailsResources extends JsonResource
{
    public function toArray($request)
    {

        $lang = $request->header('lang', '');


        if($lang == 'ar' ){
            if(!empty($this->Account()->first()->Name)){

                $name=$this->Account()->first()->Name;
            }




        }else{


            if(!empty($this->Account()->first()->NameEn)){

                $name=$this->Account()->first()->NameEn;
            }

        }


        $data = [

            'creditor'=>$this->Creditor,
            'account_code'=>$this->Account()->first()->Code,
            'account_name'=>$this->Date,
            'statement'=>$this->Statement,
        ];


        return $data ;
    }

}
