# fluent-booking/trunk/app/Models/BookingActivity.php

Fluent Booking – The Ultimate Appointments Scheduling, Events Booking, Events Calendar Solution, version trunk. 38 lines.

- Page: https://pluginprobe.com/plugins/fluent-booking/trunk/code/app/Models/BookingActivity.php
- Raw: https://pluginprobe.com/plugins/fluent-booking/trunk/raw/app/Models/BookingActivity.php
- Modified: 2024-07-16T14:25:14+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/fluent-booking/trunk/code/app/Models/BookingActivity.php#L10-L20`.

```php
<?php

namespace FluentBooking\App\Models;

class BookingActivity extends Model
{
    protected $table = 'fcal_booking_activity';

    protected $guarded = ['id'];

    protected $fillable = [
        'booking_id',
        'parent_id',
        'created_by',
        'status',
        'type',
        'title',
        'description'
    ];

    public static function boot()
    {
        parent::boot();

        static::creating(function ($model) {
            if (!isset($model->created_by) && $userId = get_current_user_id()) {
                $model->created_by = $userId;
            }
        });
    }

    public function booking()
    {
        return $this->belongsTo(Booking::class, 'booking_id');
    }

}

```
