Overview
TheFood model represents menu items in the restaurant management system. It includes details about food items such as title, price, description, nutritional information, and category relationships.
Table Information
Table Name:
foodModel Definition
Fillable Fields
The name/title of the food item
- Validation: Required, max 255 characters
- Example: “Grilled Salmon”
The price of the food item
- Database Type:
decimal(8, 2) - Validation: Required, numeric, minimum 0
- Example: 25.99
Path to the food item image
- Validation: Nullable, image file, max 2048KB
- Example: “images/food/salmon.jpg”
Description of the food item
- Validation: Nullable, string
- Example: “Fresh grilled salmon with lemon butter sauce”
List of ingredients used in the dish
- Validation: Nullable, string, max 500 characters
- Example: “Salmon, butter, lemon, herbs”
Protein content information
- Validation: Nullable, string, max 255 characters
- Example: “35g”
Calorie count of the dish
- Validation: Nullable, numeric, minimum 0
- Example: 450
Size/portion information
- Validation: Nullable, string, max 50 characters
- Example: “Medium”, “Large”
Foreign key reference to the categories table
- Validation: Nullable, must exist in categories table
- Database Constraint: Foreign key with
SET NULLon delete - Example: 1
Relationships
belongsTo: Category
Validation Rules
TheStoreFoodRequest defines the following validation rules:
Database Schema
Timestamps
created_at: Automatically set when the record is createdupdated_at: Automatically updated when the record is modified