mindtwo/appointable
最新稳定版本:0.3.0
Composer 安装命令:
composer require mindtwo/appointable
包简介
This package helps you to manage appointments within yout Laravel application.
README 文档
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.
统计信息
- 总下载量: 5
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-10-04