Skip to content

๐Ÿ“„ BookingActivity Model โ€‹

The BookingActivity model logs every significant event related to a booking, such as status changes, customer notes, or internal updates.

Attributes โ€‹

AttributeTypeDescription
idbigintPrimary key
booking_idbigintReference to the associated booking
parent_idbigintParent activity ID (for nested activities)
created_bybigintWordPress User ID of the person who created the log
statusvarcharopen, failed, success, closed
typevarcharinfo, success, error, note, email_log, etc.
titlevarcharHuman-readable title of the activity
descriptionlongtextDetailed log description
created_attimestampRecord creation time
updated_attimestampRecord last update time

Relations โ€‹

booking โ€‹

Belongs to a Booking record.

Usage Examples โ€‹

Fetching Activity for a Booking โ€‹

php
use FluentBooking\App\Models\Booking;

$activities = Booking::find(123)->booking_activities;
foreach ($activities as $activity) {
    echo $activity->title;
}

Adding a Custom Note โ€‹

php
use FluentBooking\App\Models\BookingActivity;

BookingActivity::create([
    'booking_id' => 123,
    'title' => 'Admin Note',
    'description' => 'Customer called to confirm attendance.',
    'type' => 'note'
]);