diff --git a/README.md b/README.md index e066d81..1e6fa5b 100644 --- a/README.md +++ b/README.md @@ -8,105 +8,9 @@ Laravel Calendar Recurring Events [![Daily Downloads](https://poser.pugx.org/infyomlabs/laravel-calendar-events/d/daily)](https://packagist.org/packages/infyomlabs/laravel-calendar-events) [![License](https://poser.pugx.org/infyomlabs/laravel-calendar-events/license)](https://packagist.org/packages/infyomlabs/laravel-calendar-events) -Calculate Laravel Calendar Recurring Events. -No need to store all millions of possible future events into Database. -No Cron needed to Generate Monthly events for the Database. - -1. Create `CalendarEvent` Object from your Laravel Eloquent Model -2. Specify Recurring Pattern (Daily, Weekly, Monthly, Yearly along with options) -3. Calculate Future Event Occurrences as per your need by, - 1. Next Number of Occurrences - 2. Between Given Dates - -## Installation - -You can install the package via composer: - -```bash -composer require infyomlabs/laravel-calendar-events -``` - -## Usage - -``` php - use InfyOm\LaravelCalendarEvents\CalendarEvent; - use InfyOm\LaravelCalendarEvents\CalendarEventRecurrencePattern; - - $event = new CalendarEvent([ - [ - 'id' => 1, - 'title' => 'Daily Repeat End on 30 Jan', - 'description' => 'Daily Repeat End on 30 Jan', - 'start_date' => '2021-01-10', - 'end_date' => '2021-01-20', // nullable - 'start_time' => '10:00:00', - 'end_time' => '12:00:00', - 'is_full_day' => false, - 'is_recurring' => true, - 'location' => 'Surat, India', // extra field. It will be automatically added to meta - 'meta' => [ - 'ticket_required' => true - ] - ] - ]); - - $event->recurring_pattern = new CalendarEventRecurrencePattern([ - 'recurring_type' => RecurringFrequencyType::RECURRING_TYPE_DAILY, - 'max_occurrences' => 10, // Maximum 10 Occurrences - 'repeat_interval' => 1, // Repeat Daily - 'repeat_by_days' => ["MO", "WE", "SU"], // only repeat on Monday, Wednesday and Sunday - 'repeat_by_months' => [], - ]); - - // Retrieve next 5 events. Returns CalendarEvent array. - $event->getNextEvents(5); - - // Retrieve all events between 5th Jan to 15th Jan. Returns CalendarEvent array. - $event->getEventsBetween('2021-01-05', '2021-01-15'); - - // Retrieve next 2 Occurrences. Returns \Recurr\Recurrence array - $event->getNextOccurrences(2); - - // If you Laravel Eloquent model matches the field names with above field name - $event = new CalendarEvent($calendarModle); -``` - -You can also call direct functions on `CalendarEvent` class, - -```php - $event = new CalendarEvent([ - [ - 'id' => 1, - 'title' => 'Daily Repeat End on 30 Jan', - 'description' => 'Daily Repeat End on 30 Jan', - 'start_time' => '10:00:00', - 'end_time' => '12:00:00', - 'location' => 'Surat, India', // extra field. It will be automatically added to meta - 'meta' => [ - 'ticket_required' => true - ] - ] - ]); - - $event->setStartDate(\Carbon\Carbon::parse('2021-01-10')); - $event->setEndDate(\Carbon\Carbon::parse('2021-01-20')); - $event->makeFullDay(); - $event->makeRecurring(); - - $recurringPattern = new CalendarEventRecurrencePattern(); - $recurringPattern->repeatDaily(); - $recurringPattern->setMaxOccurrences(10); - $recurringPattern->setRepeatInterval(2); - $recurringPattern->setRepeatDays(["MO", "WE", "SU"]); - - $event->recurring_pattern = $recurringPattern; -``` - -### Testing - -``` bash -composer test -``` +## Documentation + +Read [Documentation](https://infyom.com/open-source/laravel-calendar-events/docs) for detailed installation steps and usage. ## Support Us @@ -114,6 +18,12 @@ We have created [14+ Laravel packages](https://github.com/InfyOmLabs) and invest You can support us by either sponsoring us or buying one of our paid products. Or help us by spreading the word about us on social platforms via tweets and posts. +### Buy our Paid Products + +[![InfyHMS](https://assets.infyom.com/open-source/new/infyhms-banner.png)](https://1.envato.market/6by5EQ) + +You can also check out our other paid products on [CodeCanyon](https://1.envato.market/BXAnR1). + ### Sponsors [Become a sponsor](https://opencollective.com/infyomlabs#sponsor) and get your logo on our README on Github with a link to your site. @@ -126,12 +36,6 @@ You can support us by either sponsoring us or buying one of our paid products. O -### Buy our Paid Products - -[![InfyJobs](https://assets.infyom.com/open-source/infyjobs-banner.png)](https://1.envato.market/P0ONVj) - -You can also check out our other paid products on [CodeCanyon](https://codecanyon.net/user/infyomlabs/portfolio). - ### Follow Us @@ -140,3 +44,20 @@ You can also check out our other paid products on [CodeCanyon](https://codecanyo - [LinkedIn](https://in.linkedin.com/company/infyom-technologies) - [Youtube](https://www.youtube.com/channel/UC8IvwfChD6i7Wp4yZp3tNsQ) - [Contact Us](https://infyom.com/contact-us) + +## Made with InfyOm Generator + +Also, Do not forget to add your website to [Made with InfyOm Generator List](https://github.com/InfyOmLabs/laravel-generator/blob/develop/made-with-generator.md) list. + +## Security + +If you discover any security-related issues, create an issue using the issue tracker. + +## Credits + +- [InfyOm Technologies](https://github.com/infyomlabs) +- [All Contributors](../../contributors) + +## License + +The MIT License (MIT). Please see [License File](LICENSE.md) for more information.