Skip to content

๐Ÿ“… Booking Model โ€‹

The Booking model represents a scheduled appointment or booking in FluentBooking. It contains all the essential information about a booking including customer details, timing, status, and payment information.

Attributes โ€‹

AttributeTypeDescription
idbigintPrimary key
hashvarcharUnique identification hash
calendar_idbigintParent calendar ID
event_idbigintParent slot/event ID
group_idbigintGroup ID for multi-seat/group bookings
parent_idbigintParent booking ID for recurring or related bookings
host_user_idbigintWordPress User ID of the primary host
person_user_idbigintWordPress User ID of the guest (if registered)
person_contact_idbigintCRM Contact ID (if integrated)
fcrm_idbigintFluentCRM subscriber ID
person_time_zonevarcharAttendee's timezone
start_timetimestampBooking start time (UTC)
end_timetimestampBooking end time (UTC)
slot_minutesintDuration of the booking in minutes
first_namevarcharGuest's first name
last_namevarcharGuest's last name
emailvarcharGuest's email address
phonevarcharGuest's phone number
messagetextMessage provided by the guest
internal_notetextPrivate note for hosts
countryvarcharGuest's country
ip_addressvarcharIP address of the guest
browservarcharGuest's browser information
devicevarcharGuest's device information
other_infolongtext(Serialized) Custom form field data
location_detailslongtext(Serialized) Selected booking location info
cancelled_bybigintWP User ID who cancelled the booking
statusvarcharscheduled, pending, cancelled, completed, rejected, rescheduled, reserved, no_show
sourcevarcharSource of the booking โ€” web, admin, integration
booking_typevarcharscheduling, event
event_typevarcharsingle, group, round_robin, collective, etc.
payment_statusvarcharpending, paid, partially-paid, partially-refunded
payment_methodvarchare.g., stripe, paypal, offline
source_urltextURL of the page where the booking was made
source_idbigintID of the source (form, post, etc.)
utm_sourcevarcharUTM tracking source
utm_mediumvarcharUTM tracking medium
utm_campaignvarcharUTM tracking campaign
utm_termvarcharUTM tracking term
utm_contentvarcharUTM tracking content
created_attimestampRecord creation time in UTC
updated_attimestampRecord last update time in UTC

Methods โ€‹

getFullBookingDateTimeText() โ€‹

Returns a formatted string of the booking's date and time range.

isMultiGuestBooking() / isRecurringBooking() โ€‹

Check the booking type and structure.

getConfirmationUrl() / getCancelUrl() / getRescheduleUrl() โ€‹

Returns the relevant public URLs for guest actions.

getIcsDownloadUrl() โ€‹

Returns the URL to download the ICS calendar file.

canCancel() / canReschedule() โ€‹

Check if the current user/guest is permitted to perform these actions based on settings and timing.

cancelMeeting($reason, $cancelledBy) โ€‹

Cancels the meeting, updates status, and triggers notifications.

getHostProfiles() / getHostsDetails() โ€‹

Returns array of profile data for assigned hosts.

getCustomFormData($isFormatted = true) โ€‹

Retrieves custom field values submitted during booking.

updateMeta($key, $value) / getMeta($key, $default) โ€‹

Manage metadata stored in fcal_booking_meta.

getMeetingBookmarks() โ€‹

Returns list of bookmarks or record links associated with the meeting.

getAdminViewUrl() โ€‹

Returns the internal WordPress admin URL to view the booking.

Scopes โ€‹

scopeUpcoming($query) โ€‹

Filter for bookings whose end_time is in the future.

scopePast($query) โ€‹

Filter for bookings whose end_time has passed.

Advanced search by customer name, email, or hash.

scopeApplyComputedStatus($query, $status) โ€‹

Applies industry-standard filters for upcoming, completed, cancelled, and pending.

Relations โ€‹

calendar โ€‹

Belongs to the parent Calendar model.

slot / calendar_event โ€‹

Belongs to the associated CalendarSlot model.

payment_order Pro โ€‹

Has one Order record (if paid appointment).

user โ€‹

Belongs to the primary host User (via host_user_id).

booking_meta โ€‹

Has many BookingMeta records.

booking_activities โ€‹

Has many BookingActivity records.

hosts โ€‹

Belongs to many User hosts via fcal_booking_hosts pivot table.

Usage Examples โ€‹

Fetching Attendee Metadata โ€‹

php
use FluentBooking\App\Models\Booking;

$booking = Booking::find(123);
$company = $booking->getMeta('company_name');

Cancelling a Meeting via API โ€‹

php
$booking = Booking::where('hash', $hash)->first();
if ($booking) {
    $booking->cancelMeeting('Cancelled by administrator');
}