Skip to content

๐Ÿ”— BookingHost Model โ€‹

The BookingHost model serves as a pivot table for many-to-many relationships between bookings and hosts. It manages multi-host assignments and their individual confirmation statuses.

Attributes โ€‹

AttributeTypeDescription
idbigintPrimary key
booking_idbigintReference to the booking
user_idbigintWordPress User ID of the host
statusvarcharconfirmed, pending, declined
created_attimestampRecord creation time
updated_attimestampRecord last update time

Relations โ€‹

booking โ€‹

Belongs to a Booking.

host โ€‹

Belongs to a User (the host).

Usage Examples โ€‹

Checking if a host is confirmed โ€‹

php
use FluentBooking\App\Models\BookingHost;

$assignment = BookingHost::where('booking_id', 123)
    ->where('user_id', 5)
    ->first();

if ($assignment->status == 'confirmed') {
    // Show on host's agenda
}