Availability documentation #48
Comments
I agree, this is an important feature that is needed. "Get me all available slots for Wednesday for this room" is such an important feature especially if you are wanting to build a customer facing appointment system (like calendly) To have a ->getAvailability($date) command against the model would be a game changer. |
I agree. That is the most important thing. |
As we see in dosc we don'ts use default booking duration time, i think that this is because you can extends many models to be booked. I think that we should create duration constant for every model that we need, and in some cases, the user can choose their custom duration time. Based on that, i think that we need to use the custom documented function bookingsStartsBetween to create custom own function (or service) to get available datas, looping the result of:
And, making our custom logic depending of duration of service, (1, 5, 7, 15 minutes i need in this case?). So, to understand it better, i think that doesnt exist any "virtual calendar mind" available to work, so we need to get "used dates" to get our "available calendar" and show it. Another option is to work directly on Eloquent models with dates, and date parts.
I hope this helps. |
I also noticed that there isn't any built-in collision check to prevent double bookings.. seems like a big omission I've added this additional scope which I use to make sure there aren't any existing bookings prior to making a new booking. I don't think it's perfect and I had to use a bit of a hack with addSeconds / subSeconds. But so far it works for me.
And a little test
|
Thank you for your patience. The availability features implementation wasn't completed in the perfect possible way, so I'd expect some edge cases, and possibly odd behavior. I'd bee happy to consider any PRs that consolidate this feature. All PRs are welcome 😉 Added to the readme roadmap |
I understand the documentation isn't complete, but could someone help me by explaining how you can create availabilities and check for clashes in dates?
Thanks!
The text was updated successfully, but these errors were encountered: