43 lines
889 B
PHP
43 lines
889 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class Booking extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
protected $table = 'booking'; // Nama tabel
|
|
|
|
protected $primaryKey = 'id_booking'; // Primary key
|
|
|
|
public $timestamps = false; // Gunakan timestamps (created_at & updated_at)
|
|
|
|
protected $fillable = [
|
|
'id_user',
|
|
'id_kamar',
|
|
'status_booking', // Disesuaikan dengan database
|
|
'tanggal_booking',
|
|
'tanggal_checkin',
|
|
'tanggal_checkout'
|
|
];
|
|
|
|
/**
|
|
* Relasi ke model Customer
|
|
*/
|
|
public function user()
|
|
{
|
|
return $this->belongsTo(User::class, 'id_user', 'id_user');
|
|
}
|
|
|
|
/**
|
|
* Relasi ke model Room
|
|
*/
|
|
public function room()
|
|
{
|
|
return $this->belongsTo(Room::class, 'id_kamar', 'id_kamar');
|
|
}
|
|
}
|