<?php

namespace App\Http\Resources;


use Illuminate\Http\Resources\Json\JsonResource;
use DB;
use Auth;

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

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


        if(!empty($this->RV_ID()->first()->Sales_Bill)){

            $code=$this->RV_ID()->first()->Sales_Bill;
        }else{
            $code='';
        }
        if($lang == 'ar' ){
            $ACCOUNT=$this->Account()->first()->Name;


        }else{
            $ACCOUNT=$this->Account()->first()->NameEn;


        }




            $data = [

                'date'=>$this->RV_ID()->first()->Date,
                'recipt_voucher_code'=>$this->RV_ID()->first()->Code,
                'creditor'=>$this->Creditor,
                'account'=>$ACCOUNT,
                'statement'=>$this->Statement,
                'slaes_bill_code'=>$code,

            ];


        return $data ;
    }

}
