66 lines
1.3 KiB
PHP
66 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace Modules\Booking\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
use Modules\Authentication\Models\Restaurant;
|
|
|
|
class Hotel extends Model
|
|
{
|
|
protected $fillable = [
|
|
'restaurant_id',
|
|
'name',
|
|
'location',
|
|
'email',
|
|
'phone',
|
|
'description',
|
|
'latitude',
|
|
'longitude',
|
|
'check_in_time',
|
|
'check_out_time',
|
|
'status',
|
|
];
|
|
|
|
/**
|
|
* Casts
|
|
*/
|
|
protected $casts = [
|
|
'latitude' => 'decimal:7',
|
|
'longitude' => 'decimal:7',
|
|
'check_in_time' => 'datetime:H:i',
|
|
'check_out_time' => 'datetime:H:i',
|
|
'status' => 'integer',
|
|
];
|
|
|
|
public const TABLE_NAME = 'hotels';
|
|
|
|
protected $table = self::TABLE_NAME;
|
|
|
|
public function restaurant(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Restaurant::class);
|
|
}
|
|
|
|
public function floors(): HasMany
|
|
{
|
|
return $this->hasMany(Floor::class);
|
|
}
|
|
|
|
public function roomTypes(): HasMany
|
|
{
|
|
return $this->hasMany(RoomType::class);
|
|
}
|
|
|
|
public function rooms(): HasMany
|
|
{
|
|
return $this->hasMany(Room::class);
|
|
}
|
|
|
|
public function bookings(): HasMany
|
|
{
|
|
return $this->hasMany(Booking::class);
|
|
}
|
|
}
|