๐ 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 โ
| Attribute | Type | Description |
|---|---|---|
id | bigint | Primary key |
hash | varchar | Unique identification hash |
user_id | bigint | Owner's WordPress user ID |
account_id | bigint | Associated integration account ID (Optional) |
parent_id | bigint | Parent calendar ID (for teams/resources) |
title | varchar | Calendar name |
slug | varchar | Unique URL slug for the calendar landing page |
media_id | bigint | Featured image media ID |
description | text | Calendar description |
settings | longtext | JSON configuration for landing page and defaults |
status | varchar | active, inactive or expired |
type | varchar | simple (individual), team, or event |
event_type | varchar | Primary event category |
author_timezone | varchar | Default timezone for the calendar host |
account_type | varchar | free / pro |
visibility | varchar | public / admin |
max_book_per_slot | int | Default limit of guests per time slot |
created_at | timestamp | Record creation time |
updated_at | timestamp | Record 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
}