<?php

namespace App\Http\Resources;

use Carbon\Carbon;
use Illuminate\Http\Resources\Json\JsonResource;

class Schedule extends JsonResource
{
    /**
     * Transform the resource into an array.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return array
     */
    public function toArray($request)
    {
        return [
            'id' => (int)$this->id,
            'ETD' => carbon::parse($this->ETD)->format('d-m-Y'),
            'ETA' => carbon::parse($this->ETA)->format('d-m-Y'),
            'status' => (int)$this->status,
            'issue_remark' => $this->issue_remark
        ];
    }
}
