Store a beds attribute with each hostel, then you can sum bookings for a hostel grouped by date and subtract that number.
How to model availability in a simple hostel booking system? (Laravel 5.4)
I've got a simple hostel booking system and am not sure how to model availability in the database (e.g. via Eloquent). A hostel is simpler than a hotel as for booking purposes it's effectively just one big room. However there will be multiple hotels in the database (run by different owners). So my current database tables are: Guests, Hostels (includes owner details), Bookings (i.e. person W staying at hostel X from date Y to date Z), and Payments (payment amount for a stay). Obviously these are tied together (e.g. with ID references or some other relationship).
But with availability I need to represent the number of beds available for a specific hostel on any date for e.g. the next year or two. What's an efficient way to do that?
Thanks for any suggestions.
Please or to participate in this conversation.