Published 2 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:
so the usage becomes:
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: https://github.com/maddhatter/laravel-fullcalendar 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.
header: to set the buttons across the top to limit which views are shown.
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 fullcalendar.io. 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 calendar.io 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 https://laravel.com/docs/5.5/validation#form-request-validation