<?php

namespace App\Http\Resources;

use Illuminate\Http\Resources\Json\JsonResource;

class CobroView extends JsonResource
{
    /**
     * Transform the resource into an array.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return array
     */
    public function toArray($request)
    {
        return [
            "idCobro"           => strval($this->idCobro),
            "numCobro"          => substr(strval($this->idCobro), -12),
            "dateCobro"         => date("Y-m-d H:i:s",strtotime($this->dateCobro)),
            "dateCobroLite"     => date("d-m-y",strtotime($this->dateCobro)),
            "origenCobro"       => $this->origenCobro,
            "nameOrigenCobro"   => $this->nameOrigenCobro,
            "typeCobro"         => $this->typeCobro,
            "nameTypeCobro"     => $this->nameTypeCobro,
            "idE"               => strval($this->idE),
            "idEUser"           => strval($this->idEUser),
            "nameEUser"         => $this->nameE,
            "idCobrosLista"     => strval($this->idCobrosLista),
            "errorCobro"        => $this->errorCobro,
            "estadoCobro"       => $this->estadoCobro,
        ];

    }
}
