Skip to content

๐Ÿ“… Calendar Model โ€‹

The Calendar model is the top-level container for scheduling settings, availability, and events. It often represents a single host, a team, or a specific resource.

Attributes โ€‹

AttributeTypeDescription
idbigintPrimary key
hashvarcharUnique identification hash
user_idbigintOwner's WordPress user ID
account_idbigintAssociated integration account ID (Optional)
parent_idbigintParent calendar ID (for teams/resources)
titlevarcharCalendar name
slugvarcharUnique URL slug for the calendar landing page
media_idbigintFeatured image media ID
descriptiontextCalendar description
settingslongtextJSON configuration for landing page and defaults
statusvarcharactive, inactive or expired
typevarcharsimple (individual), team, or event
event_typevarcharPrimary event category
author_timezonevarcharDefault timezone for the calendar host
account_typevarcharfree / pro
visibilityvarcharpublic / admin
max_book_per_slotintDefault limit of guests per time slot
created_attimestampRecord creation time
updated_attimestampRecord last update time

Methods โ€‹

isHostCalendar() / isTeamCalendar() / isEventCalendar() โ€‹

Check the primary role/type of the calendar.

getLandingPageUrl($isForce = false) โ€‹

Returns the public URL for the calendar's landing page.

getAuthorPhoto() โ€‹

Returns the URL for the host's profile photo.

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

Manage calendar-specific metadata stored in fcal_meta.

getAuthorProfile($public = true) โ€‹

Returns an array of author details (name, avatar, etc.).

updateEventOrder($eventId) โ€‹

Updates the display order of events within this calendar.

static getAllHosts() โ€‹

Static helper to retrieve a list of all individual hosts.

Relations โ€‹

slots / events โ€‹

Has many CalendarSlot event types.

bookings โ€‹

Has many Booking records across all slots.

user โ€‹

Belongs to a User (the owner).

availabilities โ€‹

Has many Availability records.

metas โ€‹

Has many Meta records associated with this calendar.

Usage Examples โ€‹

Fetching a host's landing page โ€‹

php
use FluentBooking\App\Models\Calendar;

$calendar = Calendar::where('user_id', $userId)->where('type', 'simple')->first();
if ($calendar) {
    echo $calendar->getLandingPageUrl();
}

Checking calendar type โ€‹

php
if ($calendar->isTeamCalendar()) {
    // Show team management options
}