Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

erozas's avatar

Database design for recurring events

Hey what's up. I'm having trouble wrapping my head around a database design issue. The thing is that I have to design an application in which the user can create events based on fixed templates. Say, the user may create events of an specific type and those events created by the user can have multiple sessions. This is related to training events that are subdivided in that way. Think of the event as a training type, the schedule_event as an specific training and the event_session as the session itself. So the hierarchy I thought to implement is as follow: User (has) -> eventtemplate->scheduled_event(hast)->event_session

I'm not really sure if it's a good way to implement it. Plus, I was wondering if there should be models for every table. User and Event are models for sure but are the rest models too? Should I handle everything from an EventsController or should I create more specific controllers?

I know it's not directly related to Eloquent but it was the most fitting place to put this question.

Thanks in advance.

0 likes
2 replies
Snapey's avatar
Snapey
Best Answer
Level 122

I can't give you a full answer, but one of the considerations is if the event template changes in the future, do you expect all events to reflect the change?

IE, do you create future events using the template as a pattern or do the events all inherit from the template.

I'm struggling with similar thoughts in terms of reccurring calendar entries, discussed some time ago here; https://laracasts.com/discuss/channels/general-discussion/repeating-calendar-entries

erozas's avatar

Hey @Snapey thanks for your answer. If the event template changes, I expect for the changes to be reflected on newly created events. However, "ideally" the changes would be reflected on the events and event_sessions as well.

Please or to participate in this conversation.