I have 3 tables in a reservation system for a restaurant. So far the software was used only by restaurant’s staff, however we want to accept reservations online as well. We have some small tables for 2 that can be easily moved to each other and make room for bigger parties and I want to accept reservations automatically if all of the tables that can be combined are available.
tables
: holds all tables for each area in the restaurant.
| id | min_capacity | max_capacity | name | area |
|----|--------------|--------------|------|--------|
| 1 | 2 | 4 | #1 | Inside |
| 2 | 6 | 8 | #2 | Inside |
reservations
: holds reservation details
| id | datetime | name | status |
|----|---------------------|----------|----------|
| 1 | 2020-09-01 20:00:00 | John Doe | Upcoming |
| 2 | 2020-09-05 13:00:00 | Jane Doe | Upcoming |
And one pivot table that holds reservation <=> table relation:
| id | table_id | reservation_id |
|----|----------|----------------|
| 1 | 1 | 1 |
| 2 | 2 | 2 |
How can I store different combinations of tables (manually entered) and “attach” reservations to tables/table combinations (so I can check if tables are available for specific time) efficiently?
Go to Source
Author: Clarissa