starfolksoftware / redo
Make calendar events recurrable in your Laravel applications
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
Make calendar events recurrable in your Laravel applications.
Installation
You can install the package via composer:
composer require starfolksoftware/redo
To install the package, run the following command:
php artisan redo:install
Configurations
To disable migrations, add the following in the service provider:
Redo::ignoreMigrations();
To use a different Recurrence
model:
Redo::useRecurrenceModel('App\\Models\\CoolRecurrenceModel');
To specify the timezone Redo should use:
Redo::useTimezone('Continent/Country');
To specify the recurrences table name,
Redo::useRecurrencesTableName('new_table_name');
To turn on support for soft deletiong,
Redo::supportsSoftDeletes();
To turn on support for teams
Redo::supportsTeams();
Usage
To make a model recur, add the Recurs
trait as in the following:
use StarfolkSoftware\Redo\Recurs; class Task extends Model { // ... use Recurs; // ... }
To create a recurrence on a recur model,
$task->makeRecurrable(string $frequency, int $interval, \DateTime $startsAt, $ends = null)
To update a model's recurrence,
$task->updateRecurrence(string $frequency, int $interval, \DateTime $startsAt, $ends = null)
To pause a model's recurrence,
$task->pauseRecurrence(bool $value = true)
To check if a model's recurrence is active,
$task->recurrenceIsActive()
To return recurrences
of a model,
$task->recurrences(): \Recurr\RecurrenceCollection|\Recurr\Recurrence[] // other useful methods $task->currentRecurrence() $task->nextRecurrence() $task->firstRecurrence() $task->lastRecurrence()
To setup the team support, add the TeamHasRecurrences
trait to the team model,
use StarfolkSoftware\Redo\TeamHasRecurrences; class Team extends Model { use TeamHasRecurrences; protected $table = 'teams'; }
To create a recurrence for a team,
$team->recurrences()->save([ //... ]);
To fetch recurrences of a team,
$team->recurrences
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please recurrence our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.