46 lines
881 B
PHP
46 lines
881 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Support\Str;
|
|
|
|
class BookingModel extends Model
|
|
{
|
|
protected $table = 'booking';
|
|
|
|
protected $primaryKey = 'id_booking';
|
|
|
|
protected $keyType = 'string';
|
|
|
|
public $incrementing = false;
|
|
|
|
protected $fillable = [
|
|
'nama_lengkap',
|
|
'email',
|
|
'no_telp',
|
|
'kode_unik',
|
|
'tgl_booking',
|
|
'deskripsi_tambahan',
|
|
'status_tes'
|
|
];
|
|
|
|
protected $casts = [
|
|
'id_booking' => 'string',
|
|
];
|
|
|
|
protected static function boot()
|
|
{
|
|
parent::boot();
|
|
static::creating(function ($model) {
|
|
if (empty($model->id_booking)) {
|
|
$model->id_booking = Str::uuid();
|
|
}
|
|
|
|
if(empty($model->status_tes)) {
|
|
$model->status_tes = 0;
|
|
}
|
|
});
|
|
}
|
|
}
|