| 1 |
<?php |
| 2 |
|
| 3 |
namespace FluentBooking\App\Models; |
| 4 |
|
| 5 |
class BookingActivity extends Model |
| 6 |
{ |
| 7 |
protected $table = 'fcal_booking_activity'; |
| 8 |
|
| 9 |
protected $guarded = ['id']; |
| 10 |
|
| 11 |
protected $fillable = [ |
| 12 |
'booking_id', |
| 13 |
'parent_id', |
| 14 |
'created_by', |
| 15 |
'status', |
| 16 |
'type', |
| 17 |
'title', |
| 18 |
'description' |
| 19 |
]; |
| 20 |
|
| 21 |
public static function boot() |
| 22 |
{ |
| 23 |
parent::boot(); |
| 24 |
|
| 25 |
static::creating(function ($model) { |
| 26 |
if (!isset($model->created_by) && $userId = get_current_user_id()) { |
| 27 |
$model->created_by = $userId; |
| 28 |
} |
| 29 |
}); |
| 30 |
} |
| 31 |
|
| 32 |
public function booking() |
| 33 |
{ |
| 34 |
return $this->belongsTo(Booking::class, 'booking_id'); |
| 35 |
} |
| 36 |
|
| 37 |
} |
| 38 |
|