<?php

namespace App\Http\Resources;


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

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

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

        if($lang == 'ar'){
            $EmpName=$this->Emp()->first()->Name;
        }else{
            $EmpName=$this->Emp()->first()->NameEn;

        }
        if($lang == 'ar'){
            $ClientName=$this->Client()->first()->Name;
        }else{
            $ClientName=$this->Client()->first()->NameEn;

        }

        if ($lang == 'ar') {
            $data = [

                'date'=>$this->Date,
                'time'=>$this->Time,
                'employee'=>$EmpName,
                'client'=>$ClientName,
                'employee_id'=>$this->Emp,
                'client_id'=>$this->Client,
                'brief'=>$this->StatusNote,

            ];

        }else{

            $data = [

                'date'=>$this->Date,
                'time'=>$this->Time,
                'employee'=>$EmpName,
                'client'=>$ClientName,
                'employee_id'=>$this->Emp,
                'client_id'=>$this->Client,
                'brief'=>$this->StatusNote,


            ];

        }
        return $data ;
    }

}
