Download the PHP package mohammedmanssour/laravel-recurring-models without Composer
On this page you can find all versions of the php package mohammedmanssour/laravel-recurring-models. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download mohammedmanssour/laravel-recurring-models
More information about mohammedmanssour/laravel-recurring-models
Files in mohammedmanssour/laravel-recurring-models
Package laravel-recurring-models
Short Description Adds Repeatable functionlity to Laravel Models
License MIT
Homepage https://github.com/mohammedmanssour/laravel-recurring-models
Informations about the package laravel-recurring-models
Laravel Recurring Models
Introducing our Laravel Recurring package - the ultimate solution for adding recurring functionality to your Laravel Models! Whether you need simple daily, weekly, or every n days recurrence, or more complex patterns like repeating a model on the second Friday of every month, our package has got you covered. With a seamless integration into your Laravel application, you can easily manage and automate recurring tasks with just a few lines of code.
Installation
You can install the package via composer:
You can publish and run the migrations with:
Usage
Adding the recurring functionality to Models:
-
Make sure you models implements
Repeatable
Contract. -
Add the
Repeatable
trait to your Model - Optionaly, customize Model base date.
Model Recurring rules
The Repeatable
trait has repeat
method that will help you define the recurrence rules for the model.
The repeat
method will return Repeat
helper class that has 4 methods: daily
, everyNDays
, weekly
, and complex
1. Daily Recurrence
This will help you to create daily recurring rule for the model.
The recurrence will start the next day based on the repetitionBaseDate
returned value.
2. Every N Days Recurrence
This will help you to create every N Days recurring rules for the model.
The recurrence will start after n=3 days based on the repetitionBaseDate
returned value.
3. Weekly Recurrence
This will help ypi create weekly recurrence rule for the model.
The recurrence will start after 7 days based on the repetitionBaseDate
returned value.
You can specify the days of the recurrence using the on
method.
4. Complex Recurrence.
This will help you create complex recurrence rules for the task.
Examples
-
Repeat model on the second friday of every month.
- Repeat model on the 15th day of every month.
Model Scopes
use whereOccurresOn
scope to get models that occurres on a specific date.
use whereOccurresBetween
scope to get the models that occurres between two sepcific dates.
1. End Recurrance
use endsAt
to end occurrance on a specific date
use endsAfter
to end occurrance after n times.
2. Start Recurrance
use startsAt
method to start occurrance after a specific date.
Testing
Credits
License
The MIT License (MIT). Please see License File for more information.
All versions of laravel-recurring-models with dependencies
spatie/laravel-package-tools Version ^1.14.0
illuminate/contracts Version ^11.1