+ availability

This commit is contained in:
2026-01-26 09:06:06 +00:00
parent 18aad4749f
commit a448fce756
34 changed files with 1089 additions and 578 deletions

View File

@@ -0,0 +1,31 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Availability extends Model
{
use HasFactory;
protected $fillable = [
'room_type_id',
'start_date',
'end_date',
'is_available',
'price',
];
protected $casts = [
'is_available' => 'boolean',
'start_date' => 'date',
'end_date' => 'date',
'price' => 'decimal:2',
];
public function roomType()
{
return $this->belongsTo(RoomType::class);
}
}

View File

@@ -16,14 +16,15 @@ class Booking extends Model
'guest_name',
'guest_email',
'guest_phone',
'status',
'confirmed_at',
'is_confirmed',
'total_price',
];
protected $casts = [
'check_in' => 'date',
'check_out' => 'date',
'confirmed_at' => 'datetime',
'is_confirmed' => 'boolean',
'total_price' => 'decimal:2',
];
public function roomType()

View File

@@ -16,7 +16,7 @@ class Hotel extends Model
public function roomTypes()
{
return $this->hasMany(RoomType::class);
return $this->hasMany(\App\Models\RoomType::class);
}
//public function bookings()

View File

@@ -12,8 +12,8 @@ class RoomType extends Model
protected $fillable = [
'hotel_id',
'name',
'capacity',
'base_price',
'description',
'max_guests',
];
public function hotel()
@@ -21,13 +21,13 @@ class RoomType extends Model
return $this->belongsTo(Hotel::class);
}
public function bookings()
{
return $this->hasMany(Booking::class);
}
public function availabilities()
{
return $this->hasMany(RoomAvailability::class);
return $this->hasMany(Availability::class);
}
public function bookings()
{
return $this->hasMany(\App\Models\Booking::class);
}
}