Make calendar events recurrable in your Laravel applications

v1.0.3 2023-02-15 14:03 UTC

This package is auto-updated.

Last update: 2024-10-15 17:49:53 UTC


README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

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.