Overview
TheReservation model manages restaurant table reservations. It stores customer information, reservation details, and maintains a relationship with the tables being reserved.
Table Information
Table Name:
reservationsModel Definition
Fillable Fields
Customer name for the reservation
- Database Type:
string - Nullable: Yes
- Example: “Jane Smith”
Customer email address
- Database Type:
string - Nullable: Yes
- Example: “[email protected]”
Customer phone number
- Database Type:
string - Nullable: Yes
- Example: “+1-555-0456”
Number of guests for the reservation
- Database Type:
string - Nullable: Yes
- Example: “4”
Reservation date
- Database Type:
string - Nullable: Yes
- Example: “2026-03-15”
Reservation time
- Database Type:
string - Nullable: Yes
- Example: “19:00”
Special requests or additional notes
- Database Type:
string - Nullable: Yes
- Example: “Window seat preferred, celebrating anniversary”
Foreign key reference to the tables table
- Database Type:
unsignedBigInteger - Nullable: Yes
- Database Constraint: Foreign key with
SET NULLon delete - Example: 3
Relationships
belongsTo: Table
Database Schema
Usage Examples
Creating a Reservation
Querying Reservations
Updating a Reservation
Timestamps
created_at: Automatically set when the reservation is createdupdated_at: Automatically updated when the reservation is modified
Notes
Consider implementing validation to:
- Ensure date and time fields contain valid date/time values
- Check table availability before creating reservations
- Validate that guest count doesn’t exceed table capacity
- Prevent double-booking of tables at the same time