+ availability
This commit is contained in:
31
app/Models/Availability.php
Normal file
31
app/Models/Availability.php
Normal 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);
|
||||
}
|
||||
}
|
||||
@@ -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()
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user