Skip to content

Booking Model

Represents an individual booking (appointment) created when an attendee schedules time on a calendar.

Class

  • Source: fluent-booking/app/Models/Booking.php
  • Table: fcal_bookings
  • Primary key: id
  • Extends: Model

Attributes

ColumnTypeNullableDefaultDescription
idBIGINT(20) UNSIGNED NOT NULL PRIMARY KEYYesPrimary key for the row.
hashVARCHAR(192)YesRandom hash used as a public, non-enumerable booking identifier.
calendar_idBIGINT(20) UNSIGNEDNoForeign key to fcal_calendars.
event_idBIGINT(20) UNSIGNEDNoForeign key to fcal_calendar_events (the CalendarSlot model).
group_idBIGINT(20) UNSIGNEDYesShared group ID for bookings created together (group / collective).
fcrm_idBIGINT(20) UNSIGNEDYesOptional FluentCRM contact ID for the booker.
parent_idBIGINT(20) UNSIGNEDYesParent row used for rescheduled or grouped bookings.
host_user_idBIGINT(20) UNSIGNEDYesWordPress user ID of the host that owns the booking.
person_user_idBIGINT(20) UNSIGNEDYesWordPress user ID of the attendee, if they were logged in.
person_contact_idBIGINT(20) UNSIGNEDYesFluentCRM contact ID for the attendee, when available.
person_time_zoneVARCHAR(100)YesIANA timezone of the attendee at the time of booking.
start_timeTIMESTAMPYesBooking start time in UTC.
end_timeTIMESTAMPYesBooking end time in UTC.
slot_minutesINT(11) UNSIGNEDNoLength of the booked slot in minutes.
first_nameVARCHAR(192)YesAttendee first name.
last_nameVARCHAR(192)YesAttendee last name.
emailVARCHAR(192)YesAttendee email address.
messageTEXTYesFree-form message submitted by the attendee.
internal_noteTEXTYesInternal note visible only to hosts and admins.
phoneVARCHAR(100)YesAttendee phone number (when collected).
countryVARCHAR(100)YesAttendee country code (when collected).
ip_addressVARCHAR(192)YesIP address recorded when the booking was created.
browserVARCHAR(192)YesBrowser detected when the booking was created.
deviceVARCHAR(192)YesDevice detected when the booking was created.
other_infoLONGTEXTYesSerialized custom-field answers and miscellaneous attendee data.
location_detailsLONGTEXTYesSerialized location data (Zoom link, address, custom location).
cancelled_byBIGINT(20) UNSIGNEDYesUser ID of the person who cancelled the booking, if any.
statusVARCHAR(20)NoscheduledLifecycle status (scheduled, cancelled, completed, rejected, pending).
sourceVARCHAR(20)NowebHow the booking was created (web, api, etc.).
booking_typeVARCHAR(20)NoschedulingInternal booking subtype.
event_typeVARCHAR(20)Nosinglesingle or group event.
payment_statusVARCHAR(20)YesPayment lifecycle status (pending, paid, refunded).
payment_methodVARCHAR(20)YesSelected payment method slug.
source_urlTEXTYesReferring URL where the booking originated.
source_idBIGINT(20) UNSIGNEDYesGeneric foreign key for the source record (form ID, etc.).
utm_sourceVARCHAR(192)Yes``Marketing UTM source value.
utm_mediumVARCHAR(192)Yes``Marketing UTM medium value.
utm_campaignVARCHAR(192)Yes``Marketing UTM campaign value.
utm_termVARCHAR(192)Yes``Marketing UTM term value.
utm_contentVARCHAR(192)Yes``Marketing UTM content value.
created_atTIMESTAMPYesCreation timestamp maintained by the ORM.
updated_atTIMESTAMPYesUpdate timestamp maintained by the ORM.

Relationships

MethodTypeTarget
calendar()belongsToCalendar
slot()belongsToCalendarSlot
calendar_event()belongsToCalendarSlot
booking_meta()hasManyBookingMeta
booking_activities()hasManyBookingActivity
user()belongsToUser
hosts()belongsToMany$class
payment_order()hasOneOrder

Query Scopes

ScopeParameters
Upcoming$query
Past$query
ApplyDateRangeFilter$query, $range
ApplyComputedStatus$query, $status
ApplyBookingOrderByStatus$query, $status
SearchBy$query, $search

Public Methods (sample)

MethodSignature
calendar()
slot()
calendar_event()
booking_meta()
booking_activities()
user()
assignNextGroupId()
getCustomFormData()$isFormatted = true, $isPublic = false
getHostTotalBooking()$eventId, $hostIds, $ranges
getAdditionalGuests()$isHtml = false
getTotalGuestCount()
getHostEmails()$excludeHostId = null
hosts()
getHostIds()
getFullBookingDateTimeText()$timeZone = 'UTC', $isHtml = false
getPreviousMeetingDateTimeText()$timeZone = 'UTC'
getShortBookingDateTime()$timeZone = 'UTC'
getPreviousMeetingTime()$timeZone = 'UTC'
getAttendeeStartTime()$format = 'Y-m-d H:i:s'
getAttendeeEndTime()$format = 'Y-m-d H:i:s'
getOtherBookingTimes()
getAllBookingShortTimes()$timeZone = 'UTC', $withTimeZone = false
getAllBookingFullTimes()$timeZone = 'UTC', $withTimeZone = false
getHostAndGuestDetailsHtml()
getLocationDetailsHtml()
getLocationAsText()
getMessage()
setLocationDetailsAttribute()$locationDetails
getLocationDetailsAttribute()$locationDetails
setOtherInfoAttribute()$otherInfo