<?php

namespace Modules\User\Models\Resources;

use Modules\City\Models\Resources\CityResource;
use Modules\Area\Models\Resources\AreaResource;
use Illuminate\Http\Resources\Json\JsonResource;

class AddressResource extends JsonResource
{
    /**
     * Transform the resource into an array.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return array
     */
    public function toArray($request)
    {
        return [
            'id' => $this->id,
            'user_status'=>$this->user_status,
            'title'=>$this->title,
            'address'=>$this->address,
            'latitude'=>$this->latitude,
            'longitude'=>$this->longitude,
            'city' =>new CityResource($this->whenLoaded('city')),
            'area' =>new AreaResource($this->whenLoaded('area')),
            
      ];
    }
}
