mindtwo / appointable
This package helps you to manage appointments within yout Laravel application.
Fund package maintenance!
mindtwo GmbH
Requires
- php: ^8.3
- illuminate/contracts: ^11.0
- mindtwo/laravel-auto-create-uuid: ^2.6
- spatie/laravel-data: ^4.0
Requires (Dev)
- larastan/larastan: ^2.0
- laravel/pint: ^1.2
- orchestra/testbench: ^9.0
- pestphp/pest: ^2.34
- phpstan/phpstan-phpunit: ^1.0
README
Introduction
Appointable is a Laravel package by mindtwo that provides an appointment management system with configurable routes and controllers. It allows developers to manage appointments, handle invitations, and provide easy-to-use RESTful endpoints for various appointment-related actions. This package comes with built-in routes, a service provider, and configuration options for quick integration.
Features
- Create and auto-manage appointments for Eloquent models
- Registerable routes for managing appointments.
- RESTful controllers for creating, updating, canceling, and managing invitations.
- Middleware support for secure appointment routes.
Installation
-
Install the package via Composer:
composer require mindtwo/appointable
-
(Optional) Publish the configuration and migration files:
php artisan vendor:publish --provider="mindtwo\Appointable\Providers\AppointableServiceProvider" --tag="appointable-config" php artisan vendor:publish --provider="mindtwo\Appointable\Providers\AppointableServiceProvider" --tag="appointable-migrations"
-
Run the migrations:
php artisan migrate
Usage
Register Routes
To register the default appointment management routes, simply call the Appointable::routes()
method in your web.php
routes file.
use mindtwo\Appointable\Facades\Appointable; // Register the default appointment routes Appointable::routes();
By default, the routes will be registered under the /appointments
prefix. You can customize the prefix and middleware by passing options to the routes()
method:
Appointable::routes('my-appointments', ['auth']);
This will register the routes under /my-appointments
and apply the auth
middleware.
Available Routes
The following routes are registered when using Appointable::routes()
:
- GET
/appointments
– List all appointments (Index). - POST
/appointments
– Create a new appointment. - PUT|PATCH
/appointments/{uuidOrUid}
– Update an appointment. - DELETE
/appointments/{uuidOrUid}
– Cancel an appointment. - POST
/appointments/{uuidOrUid}/confirm
– Confirm an appointment invitation. - POST
/appointments/{uuidOrUid}/decline
– Decline an appointment invitation.
Middleware
By default, no middleware is applied to the routes. You can specify custom middleware in the routes()
method:
Appointable::routes('appointments', ['auth', 'verified']);
Configurations
You can customize the behavior of the package through its configuration file. After publishing the configuration, modify the config/appointable.php
file as needed.
return [ 'middleware' => ['web'], ];
Migrations
The package provides a migration file to create the appointments
table. You can publish the migration with:
php artisan vendor:publish --provider="mindtwo\Appointable\Providers\AppointableServiceProvider" --tag="appointable-migrations"
After publishing, run the migration:
php artisan migrate
License
This package is open-sourced software licensed under the MIT license.