<?php

namespace App\Http\Resources;

use Illuminate\Http\Resources\Json\JsonResource;

class ArticleResource extends JsonResource
{
    /**
     * Transform the resource into an array.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return array
     */
    public function toArray($request)
    {
        // return parent::toArray($request);
        return [
            'id' => $this->id,
            'name' => $this->descriptions(currentLanguage()->id)['name'],
           'description'=>strip_tags($this->descriptions(currentLanguage()->id)['description']),
            'image' => asset('').$this->image,
            'date' => date('F j, Y',strtotime($this->created_at)),
            'time' => date('g:i a',strtotime($this->created_at)),
            
      ];
    }
}
