<?php

namespace App\Http\Resources;

use Illuminate\Http\Resources\Json\JsonResource;
use App\CategoryDescription;
use App\CityDescription;
use App\Models;
use App\Http\Resources\AreaResource;
use App\Http\Resources\AttributeResource;

class CityResource extends JsonResource
{
    /**
     * Transform the resource into an array.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return array
     */
     
    public function toArray($request)
    {
        
       
       
        $data =  [
            'id' => $this->id,
            'name' => $this->descriptions(currentLanguage()->id)['name'],
           
            
            
            'areas'=>AreaResource::collection($this->whenLoaded('areas')),
            
            
            
      ];
      return $data;
    }
}
