starfolksoftware / redo
在Laravel应用程序中使日历事件可重复
v1.0.3
2023-02-15 14:03 UTC
Requires
- php: ^8.1
- simshaun/recurr: ^5.0
- spatie/laravel-package-tools: ^1.13.0
Requires (Dev)
- laravel/pint: ^1.0
- nunomaduro/collision: ^6.0|^7.0
- nunomaduro/larastan: ^2.0.1
- orchestra/testbench: ^7.0|^8.0
- pestphp/pest: ^1.21
- pestphp/pest-plugin-laravel: ^1.1
- phpstan/extension-installer: ^1.1
- phpstan/phpstan-deprecation-rules: ^1.0
- phpstan/phpstan-phpunit: ^1.0
- phpunit/phpunit: ^9.5
README
在Laravel应用程序中使日历事件可重复。
安装
您可以通过composer安装此软件包
composer require starfolksoftware/redo
要安装软件包,请运行以下命令
php artisan redo:install
配置
要禁用迁移,在服务提供程序中添加以下内容
Redo::ignoreMigrations();
要使用不同的 Recurrence
模型
Redo::useRecurrenceModel('App\\Models\\CoolRecurrenceModel');
要指定Redo应使用的时区
Redo::useTimezone('Continent/Country');
要指定重复事件表名
Redo::useRecurrencesTableName('new_table_name');
要开启软删除支持
Redo::supportsSoftDeletes();
要开启团队支持
Redo::supportsTeams();
用法
要将模型设置为可重复,请添加以下 Recurs
特性
use StarfolkSoftware\Redo\Recurs; class Task extends Model { // ... use Recurs; // ... }
要在可重复模型上创建重复事件
$task->makeRecurrable(string $frequency, int $interval, \DateTime $startsAt, $ends = null)
要更新模型的重复事件
$task->updateRecurrence(string $frequency, int $interval, \DateTime $startsAt, $ends = null)
要暂停模型的重复事件
$task->pauseRecurrence(bool $value = true)
要检查模型的重复事件是否处于活动状态
$task->recurrenceIsActive()
要返回模型的 recurrences
$task->recurrences(): \Recurr\RecurrenceCollection|\Recurr\Recurrence[] // other useful methods $task->currentRecurrence() $task->nextRecurrence() $task->firstRecurrence() $task->lastRecurrence()
要设置团队支持,请将 TeamHasRecurrences
特性添加到团队模型中
use StarfolkSoftware\Redo\TeamHasRecurrences; class Team extends Model { use TeamHasRecurrences; protected $table = 'teams'; }
要为团队创建重复事件
$team->recurrences()->save([ //... ]);
要获取团队的重复事件
$team->recurrences
测试
composer test
变更日志
请参阅变更日志以获取有关最近更改的更多信息。
贡献
请参阅贡献指南以获取详细信息。
安全漏洞
请参阅我们的安全策略以了解如何报告安全漏洞。
鸣谢
许可
MIT许可证(MIT)。请参阅许可文件以获取更多信息。