<?php

namespace App\Http\Resources\Company;

use Illuminate\Http\Resources\Json\JsonResource;

class Tasks extends JsonResource
{
    /**
     * Transform the resource into an array.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable
     */
    public function toArray($request)
    {
        return [
            'id' => $this->id,
            'link' => $this->link,
            'message' => $this->message,
            'reference_id' => $this->reference_id,
            'worker_request_id' => $this->worker_request_id? $this->worker_request_id : "Not A Worker Request",
            'is_read' => $this->is_read,
            'created_at' => date('F d, Y h:i A', strtotime($this->created_at)),
        ];
    }
}
