Laravel + Calendar: How to Deal With Recurring Events

preview_player
Показать описание
Another demo-project - how to save calendar events that occur daily/weekly/monthly.

- - - - -

- - - - -
Рекомендации по теме
Комментарии
Автор

Exactly what I'm searching for I got from you. Thank you so much. You saved my 1 Week coding.

anandchoudharyofficial
Автор

I've done calendars before and implemented them in a similar fashion. Potential improvements:
Add an option for Repeats Every X Days/Weeks/Months/Years.
Require a "Repeats Until" field, so you know when/where to stop inserting (using current method) and for your query if/when you move away from multiple inserts and store exceptions instead.

JeremyStreich
Автор

I had implemented something similar without reaping database entries for a single event, so the idea is for yearly, monthly, weekly, or any custom days just need to enter only a single DB entry. Right now in your case, it will add lots of records on the database lets say if any event repeats daily for a year then you have to enter 365 records which is I think not a good idea on the DB level.

prakashmalaviya
Автор

It is possible not to create record of the future events? For example it will display that you have a monthly events but it should not create records yet. Because it will consume a lot of data in the database.

mananapka
Автор

Hi there, I have added another column to the database called number_repeats, and added that to the loop to loop through that many times, for example, I only want a monthly event created for 5 months. That's fine.


You have daily, weekly, and monthly events here, but how do I apply to yearly events, like birthday's for example?

AdrianStoker
Автор

There are events that are recurring in nature but dates keep changing such as festivals from different countries like holi, diwali, etc.
Is there any provision for this too? I mean changing the dates every year for the same event as there is no other change than date.

AvaneeshKumarSingh
Автор

Is it possible to do this inside QuickAdmin panel using the CRUD creator? I'm having issues trying to do so

davidomalley
Автор

Hi Povilas, nice approach, I done similar,
but I am not sure, is it ok to do hundred query inserts in database at once? Tnx

Dzonikblo
Автор

I have a question, but i opened a github issue to explain it better, if you can help... Thanks for the great project!

WillanCorreia
Автор

What if they delete the main event (#1 for instance), but still have other existing events from the series? I think it would break at that point off the event_id field? May be better to use a series ID and random generate it, assign to all related events. Then if you delete even the main one, it'll still work

Laravel has a built in id generator too

JamesAutoDude
Автор

Very bad approach, this should not create database records, the best option is having some sort of metadata and recurring via a job

YoosufMo