<?php

namespace App\Http\Resources;

use Illuminate\Http\Resources\Json\JsonResource;
use App\CategoryDescription;
use App\PageDescription;
use App\Models;
use App\Http\Resources\CountryResource;
use App\Http\Resources\AttributeResource;

class PageResource extends JsonResource
{
    /**
     * Transform the resource into an array.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return array
     */
     
    public function toArray($request)
    {
        
       
        $vowels = array("&nbsp;", "&ndash;", "&bull;","\r\n","&ldquo;","&rdquo;");
       
        $data =  [
            'id' => $this->id,
            'image'=>asset('').$this->image,
            'name' => $this->descriptions(currentLanguage()->id)['title'],
            'description'=> str_replace($vowels, ' ', strip_tags($this->descriptions(currentLanguage()->id)['description'])),
            
            
            
            
            
      ];
      return $data;
    }
}
