NewWe open-sourced 50+ Laravel packages
Custom AI apps, agents and automation — Roundly ConsultingRoundly
All packages

The Appointment model ships scopes for the common schedule queries:

use RoundlyConsulting\Appointments\Enums\Status;
use RoundlyConsulting\Appointments\Models\Appointment;

Appointment::query()->upcoming()->forParticipant($user)->ordered()->get();
Appointment::query()->between($from, $to)->get();
Appointment::query()->overlapping($start, $end)->get();
Appointment::query()->withStatus(Status::Confirmed, Status::Completed)->get();
Appointment::query()->past()->get();
ScopeFilter
upcoming()starts_at at or after now.
past()starts_at before now.
between($from, $to)starts_at between the two instants, inclusive.
overlapping($start, $end)Starts before $end and ends after $start (or has no end). Touching ranges don’t overlap.
withStatus(Status ...$statuses)Any of the given statuses — variadic.
forParticipant(Model $participant)Appointments the given model takes part in.
ordered()Ordered by starts_at, earliest first.
withinRadius(Coordinates $center, float $km)Venue inside the radius’s bounding box — from geolocation-for-laravel.

Per-model schedules

Because HasAppointments returns a query builder, the same scopes chain off any participant model:

// the same scopes chain off HasAppointments
$user->appointments()->upcoming()->withStatus(Status::Confirmed)->ordered()->get();
$room->appointments()->overlapping($start, $end)->exists();

The time scopes compare against the UTC columns, so their Carbon arguments may be in any timezone. Soft-deleted appointments are excluded by Eloquent’s SoftDeletes scope, as everywhere else in Laravel.

Show your open-source love

This package is free and MIT-licensed. If it saves you time, a one-off donation or a Patreon membership keeps it maintained, tested and documented.

More ways to support, including crypto

By donating, you agree to our donation terms.

Want this built into your product?

We integrate our packages into custom Laravel and AI builds. Tell us what you're working on and we'll reply within 48 hours.