<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class Hotel extends Model
{
    use HasFactory;
    protected $fillable = [
        'name',
        'description_fr',
        'description_en',
        'has_cleaning',
        'has_wifi',
        'has_breakfast',
        'city',
        'emplacement',
        'lat',
        'longi',
        'number_of_beds',
        'number_of_bathrooms',
        'number_of_ac',
        'details_fr',
        'details_en',
        'price_standard',
        'price_premium',
        'price_suite',
    ];

    public function images()
    {
        return $this->hasMany(HotelImage::class);
    }

    public function getImageUrlsAttribute()
    {
        return $this->images->map(function($image) {
            return $image->image_url; // Utilise l'accesseur de SiteImage
        });
    }


}
