Creating a Schedule/calendar

Published 8 months ago by distantplanet

I need to create a calendar where user's can reserve time slots. The time slots cannot overlap.

Each time slot needs to be stored in a DB table or be linked to a DB table for an associated post.

There seems to be a lot of different ways to do this so i'm mostly seeking advice on the best way to go about this. Any recommendations of frameworks or libraries that would be best for this would be appreciated! Also any related tutorial would also be helpful.



It's weird because this is a common and difficult problem. Yet finding a package for this is hard. What do you google for: 'Calendar'? Nope. That's not what you want. (well it's helpful but you really need the hard part -- the timeslot manager.).

my thoughts on this are:

  • you have a set number of timeslots (in a db or in a file).
  • for each period (day, week or whatever). you have a dataset of unavailable (or the inverse) timeslots.
  • each time a timeslot is booked, you updated the dataset of unavailable slots.

so the usage becomes:

  • given a request for a timeslot in a specified period
  • then you query the list of unavailable slots (for a used slot matching the request)
  • if you find a used slot. then go fish (or suggest alternates)
  • otherwise book it.

the idea of the set number of timeslots makes sense to me (rather than being dynamic) is that the fixed system is much easier to do. This is how reservation systems work for restaurants etc. They have 6:00 seatings, 7:30 etc.

just rambling. maybe I'll make a package


An alternative to RobRogers3's response, you could also try playing with full calendar and there are some packages to link laravel to full calendar like this one: and set things like:

eventOverlap: false // so that each timeslot is only usable once

defaultTimedEventDuration: '00:30:00 // set to whatever your required slot duration is

eventDurationEditable: false // to force any dragging of the item to just move rather than extend the length of the timeslot

You could also change the view so that only the Week or Day view is shown since those space out the timeslots more visibly than a month view. defaultView: basicWeek use the header: to set the buttons across the top to limit which views are shown.

You can play around with a few more options. That would all be done in javascript during the call to render the calendar.

I had done something similar a while back and you do an api call back to your laravel back end whenever an event is dragged, created, etc. and in the backend you can do a second validation to make sure the selected timeslot is free, that the given user doesn't already have a timeslot taken, whatever you like. If you fail the validation then return an error and deal with it in javascript with fullcalendar, if you pass then you allow fullcalendar to render the item in the selected timeslot and flash a success message.

You can then sync it to a google calendar if you wanted.

I will try and find some code that did something like this and stick it up here later when I can dig it up.


This package is for Which is fantastic. But it doesn't help you manage timeslots.

There is no 'validation' against booking a timeslot that has already been booked. There is no definitions of timeslots except perhaps what has.

Again, it's the second part of what you need for this.


@robrogers3 You'll get lucky to find something written for you that meets all specific requirements. You'll most likely need to write some code! :)

The validation against time slots should really be done server side. i.e. you'd post data to your API which would validate against a form request - see


@Robstar yeah my point exactly.

the hard part is managing the slots.

but you woudl think there would be some solution (in any language)

Please sign in or create an account to participate in this conversation.