<?php

namespace App\Http\Resources;

use App\Helpers\ImageHelper;
use App\User;
use Illuminate\Http\Resources\Json\JsonResource;

/**
 * @property mixed id
 * @property mixed comment
 * @property mixed user_id
 * @property mixed hotel_id
 * @property mixed evaluate_average
 * @property mixed umrah_trip_id
 * @property mixed status
 * @property mixed created_at
 * @property mixed hotel_reservation_id
 * @property mixed umrah_trip_reservation_id
 * @property mixed updated_at
 * @property mixed user
 * @property mixed consulting
 */
class EvaluateResource extends JsonResource
{
    /**
     * Transform the resource into an array.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return array
     */
    public function toArray($request)
    {
        return [
            'id' => $this->id,
//            'consulting_request' => $this->consulting ? ConsultingRequestResource::make($this->consulting) : null,
            'user_id' => $this->user_id,
            'comment' => $this->comment,
            'evaluate_average' => $this->evaluate_average,
            'status' => $this->status,
            'user_name' => $this->user ? $this->user->name : '',
            'user_image' => $this->user ? ImageHelper::getFullPath($this->user->photo ?? 'uploads/avatar.png') : '',
//            'created_at' => $this->created_at,
//            'updated_at' => $this->updated_at,


        ];
    }
}
