This document is a comprehensive guide for the laravel-appointments Laravel package, designed for scheduling, managing, and tracking appointments.
-
Installation:
composer require redberry/laravel-appointments
-
Publish Configuration (if applicable):
php artisan vendor:publish --tag="laravel-appointments-config" -
Database Migration:
php artisan migrate
-
Schedule an Appointment
- Schedule an appointment for a user at a specified timestamp.
use Redberry\Appointments\Facades\Appointment; Appointment::with($doctor)->for($user)->schedule(at: $timestamp);
-
Reschedule an Appointment
- Change the time of an existing appointment.
Appointment::for($user)->reschedule(at: $timestamp);
-
Cancel an Appointment
- Cancel a scheduled appointment.
Appointment::for($user)->cancel();
-
Retrieve Available Dates
- Get dates with available appointment slots.
$availableDates = Appointment::availableDates();
-
Retrieve Booked Dates
- Get dates with no available appointment slots.
$bookedDates = Appointment::bookedDates();
-
Available Time Slots for a Date
- Get available time slots for a specific date.
$availableTimeSlots = Appointment::date($date)->availableTimeslots();
-
Booked Time Slots for a Date
- Get booked time slots for a specific date.
$bookedTimeSlots = Appointment::date($date)->bookedTimeslots();
The package fires several events related to appointment activities:
- AppointmentScheduled
- AppointmentReschedule
- AppointmentCanceled
Developers can listen to these events in their application's EventServiceProvider:
protected $listen = [
\Redberry\Appointments\Events\AppointmentScheduled::class => [
\App\Listeners\HandleAppointmentScheduled::class,
],
\Redberry\Appointments\Events\AppointmentRescheduled::class => [
\App\Listeners\HandleAppointmentRescheduled::class,
],
\Redberry\Appointments\Events\AppointmentCanceled::class => [
\App\Listeners\HandleAppointmentCanceled::class,
],
];- Pest
- Instructions for contributing to the package, including coding standards and pull request processes.
- Outline of planned features and enhancements, and an invitation for community feedback and suggestions.