Make calendar events recurrable in your Laravel applications.
You can install the package via composer:
composer require starfolksoftware/redo
To install the package, run the following command:
php artisan redo:install
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();
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
composer test
Please see CHANGELOG for more information on what has changed recently.
Please see CONTRIBUTING for details.
Please recurrence our security policy on how to report security vulnerabilities.
The MIT License (MIT). Please see License File for more information.