Files
kulakpos_web/public/restaurant/Modules/Booking/app/Models/Room.php

80 lines
1.7 KiB
PHP
Raw Normal View History

2026-03-15 17:08:23 +07:00
<?php
namespace Modules\Booking\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;
class Room extends Model
{
protected $fillable = [
'restaurant_id',
'hotel_id',
'floor_id',
'room_type_id',
'room_number',
'room_code',
'slug',
'max_adults',
'max_children',
'has_balcony',
'has_bathtub',
'view_type',
'image',
'banner_image',
'gallery_images',
'description',
'regular_price',
'offer_price',
'is_clean',
'is_available',
'status',
'created_at',
'updated_at',
'deleted_at',
];
/**
* Casts
*/
protected $casts = [
'restaurant_id' => 'integer',
'hotel_id' => 'integer',
'floor_id' => 'integer',
'room_type_id' => 'integer',
'max_adults' => 'integer',
'max_children' => 'integer',
'has_balcony' => 'boolean',
'has_bathtub' => 'boolean',
'gallery_images' => 'array',
'is_clean' => 'boolean',
'is_available' => 'boolean',
'status' => 'integer',
];
public const TABLE_NAME = 'rooms';
protected $table = self::TABLE_NAME;
public function hotel(): BelongsTo
{
return $this->belongsTo(Hotel::class);
}
public function floor(): BelongsTo
{
return $this->belongsTo(Floor::class);
}
public function roomType(): BelongsTo
{
return $this->belongsTo(RoomType::class);
}
public function bookings(): HasMany
{
return $this->hasMany(BookingItem::class, 'room_id');
}
}