<?php

namespace Modules\Cheque\Transformers;

use Illuminate\Http\Resources\Json\JsonResource;

class ChequesListResource extends JsonResource
{
    /**
     * Transform the resource into an array.
     *
     * @param  \Illuminate\Http\Request
     * @return array
     */
    public function toArray($request)
    {
        return [
            'id'=>$this->id,
            'exporter'=>$this->exporterable->first_name.' '.$this->exporterable->last_name,
            'price'=>$this->price,
            'received_date'=>verta($this->date_received)->format('Y-m-d'),
            'checkout_date'=>verta($this->checkout_date)->format('Y-m-d'),
        ];
    }
}
