<?php

namespace App\Models;

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

class Booking extends Model
{
    use HasFactory, SoftDeletes;

    protected $fillable = [
        'invoice_id',
        'id_room',
        // 'id_property',
        'id_user',
        'checkin',
        'start_date',
        'end_date',
        'total_price',
        'status',
        'quantity',
    ];

    public function user()
    {
        return $this->belongsTo(User::class, 'id_user');
    }

    public function payments()
    {
        return $this->hasMany(Payment::class, 'invoice_id', 'invoice_id');
    }

    public function room()
    {
        return $this->belongsTo(Rooms::class, 'id_room');
    }

    // public function property()
    // {
    //     return $this->belongsTo(Property::class, 'id');
    // }

}
