๐ BookingActivity Model โ
The BookingActivity model logs every significant event related to a booking, such as status changes, customer notes, or internal updates.
Attributes โ
| Attribute | Type | Description |
|---|---|---|
id | bigint | Primary key |
booking_id | bigint | Reference to the associated booking |
parent_id | bigint | Parent activity ID (for nested activities) |
created_by | bigint | WordPress User ID of the person who created the log |
status | varchar | open, failed, success, closed |
type | varchar | info, success, error, note, email_log, etc. |
title | varchar | Human-readable title of the activity |
description | longtext | Detailed log description |
created_at | timestamp | Record creation time |
updated_at | timestamp | Record 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'
]);