Overview
TheTable model represents physical tables in the restaurant. It manages table information including location type, capacity, availability status, and relationships with orders and reservations.
Table Information
Table Name:
tablesModel Definition
Fillable Fields
Display name for the table
- Database Type:
string - Nullable: No
- Example: “Table Alpha”, “VIP-1”
Unique table number identifier
- Database Type:
string - Nullable: No
- Unique: Yes
- Example: “T-101”, “12”
Location type of the table
- Database Type:
enum - Allowed Values:
terraza,interior,exterior - Example: “interior”
Current availability status of the table
- Database Type:
enum - Allowed Values:
disponible,ocupada,reservada - Default:
disponible - Example: “disponible”
Number of seats available at the table
- Database Type:
integer - Nullable: No
- Example: 4
Status Values
Table is available for new customers or reservations
Table is currently occupied by customers
Table has been reserved for a future booking
Type Values
Table located on the terrace area
Table located inside the restaurant
Table located in the exterior area
Relationships
hasMany: Orders
hasOne: Reservation
Database Schema
Usage Examples
Creating a Table
Querying Tables
Updating Table Status
Complex Queries
Timestamps
created_at: Automatically set when the table record is createdupdated_at: Automatically updated when the table record is modified
Best Practices
When managing table status:
- Always update status to
ocupadawhen customers are seated - Set status to
reservadawhen a reservation is confirmed - Return status to
disponibleafter customers leave - Consider implementing automatic status updates based on reservation times