<?php

namespace App\Http\Resources;

use Illuminate\Http\Resources\Json\JsonResource;

class CobrosListaView extends JsonResource
{
    /**
     * Transform the resource into an array.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return array
     */
    public function toArray($request)
    {
        return [
            "idCobrosLista"     => strval($this->idCobrosLista),
            "dateCobrosLista"   => date("Y-m-d H:i:s",strtotime($this->dateCobrosLista)),
            "idEUser"           => strval($this->idEUser),
            "nameEUser"         => $this->nameE,
            "typeCobrosLista"   => $this->typeCobrosLista,
            "typeTxt"           => $this->nameCobrosLista,
            "dateCobro"         => is_null($this->dateCobro)?'':date("Y-m-d",strtotime($this->dateCobro)),
        ];

    }
}
