# Smart QR Menu & Restaurant Order Management SaaS
## Complete Development Guide, Architecture & Functionality Document

---

## 1. Project Overview

### Project Name
**Smart QR Menu & Restaurant Order Management SaaS**

### Purpose
This project is a **white-label restaurant QR menu and order management SaaS platform**. It allows a company or agency to sell digital QR menu and table-wise ordering services to multiple restaurants under its own brand.

The platform should support:

- Multiple restaurants
- Restaurant-wise admin panels
- Table-wise QR code menus
- Customer menu browsing without login
- Online or WhatsApp order placement
- Restaurant order dashboard
- Waiter and kitchen staff panel
- Subscription plans
- Razorpay payment integration
- White-label branding
- Mobile-first customer experience

---

## 2. Recommended Tech Stack

### Backend
```txt
PHP 8.2+
Laravel latest stable version
MySQL
Laravel Eloquent ORM
Laravel Queues optional
Laravel Scheduler optional
```

### Frontend
```txt
Laravel Blade
Tailwind CSS
Alpine.js / Vanilla JavaScript
Lucide Icons / Heroicons
```

### Authentication
```txt
Laravel Breeze / Custom Laravel Auth
Role-based middleware
```

### Payment
```txt
Razorpay Payment Gateway
```

### QR Code
```txt
simple-qrcode Laravel package
```

### Image Processing
```txt
Intervention Image
```

### Hosting
```txt
VPS / Hostinger VPS / DigitalOcean / AWS Lightsail
Ubuntu
Nginx
MySQL
PHP-FPM
SSL via Let's Encrypt
Cloudflare optional
```

---

## 3. Main Business Use Case

The SaaS owner can sell this product to restaurants, cafes, hotels, cloud kitchens, bakeries, and food courts.

Restaurants will receive:

- Digital QR menu
- Table-wise QR code
- Menu management panel
- Order dashboard
- Staff panel
- WhatsApp order option
- QR code PNG download
- Branding customization

The SaaS owner earns through:

- Setup fee
- Monthly subscription
- Yearly subscription
- QR standee design
- Custom domain add-on
- Menu management add-on
- Restaurant marketing services

---

## 4. User Roles

The platform must support four major user types.

---

### 4.1 Super Admin

The Super Admin is the platform owner.

#### Super Admin Responsibilities

- Manage all restaurants
- Create restaurant accounts
- Manage subscription plans
- Manage restaurant subscriptions
- View all payments
- Enable or disable restaurants
- View global revenue
- View active and expired restaurants
- Generate or manage QR codes
- Manage white-label platform settings
- Monitor activity logs

#### Super Admin Pages

```txt
/super-admin/dashboard
/super-admin/restaurants
/super-admin/restaurants/create
/super-admin/restaurants/{id}/edit
/super-admin/plans
/super-admin/subscriptions
/super-admin/payments
/super-admin/settings
/super-admin/activity-logs
```

---

### 4.2 Restaurant Admin

The Restaurant Admin is the restaurant owner or manager.

#### Restaurant Admin Responsibilities

- Manage restaurant profile
- Upload logo and cover image
- Set restaurant theme color
- Manage categories
- Manage menu items
- Upload food images
- Manage tables
- Generate table QR codes
- View and manage orders
- Accept or reject orders
- Update order status
- Manage waiter and kitchen staff
- View daily and monthly reports
- Manage WhatsApp order settings
- Download QR code images

#### Restaurant Admin Pages

```txt
/restaurant-admin/dashboard
/restaurant-admin/profile
/restaurant-admin/categories
/restaurant-admin/menu-items
/restaurant-admin/tables
/restaurant-admin/qr-codes
/restaurant-admin/orders
/restaurant-admin/staff
/restaurant-admin/reports
/restaurant-admin/settings
```

---

### 4.3 Waiter / Kitchen Staff

Staff users have limited access.

#### Staff Responsibilities

- View orders of their restaurant
- See table number
- See ordered items
- Update order status
- Mark order as preparing, ready, served, or completed

#### Staff Pages

```txt
/staff/orders
/staff/orders/{id}
```

Staff should not access:

- Billing
- Restaurant settings
- Subscription details
- Other restaurant data

---

### 4.4 Customer

Customer does not need login.

#### Customer Flow

```txt
Scan QR code
Open mobile menu
Browse categories
Search food items
Add items to cart
Add special instructions
Place order
See order confirmation
Optionally send order through WhatsApp
```

#### Customer Pages

```txt
/menu/{restaurant_slug}
/menu/{restaurant_slug}/table/{table_code}
/order-success/{order_number}
```

---

## 5. Software Architecture

Use a **single database multi-tenant architecture**.

Each restaurant's data must be separated using `restaurant_id`.

This means:

- Every menu category belongs to one restaurant
- Every menu item belongs to one restaurant
- Every order belongs to one restaurant
- Every table belongs to one restaurant
- Every staff member belongs to one restaurant
- Restaurant admins can only access their own restaurant data

---

## 6. High-Level System Flow

```txt
Super Admin creates restaurant
↓
Restaurant Admin receives login
↓
Restaurant Admin adds categories and menu items
↓
Restaurant Admin creates dining tables
↓
System generates table-wise QR codes
↓
Customer scans QR code
↓
Customer opens restaurant menu
↓
Customer places order
↓
Restaurant Admin / Staff receives order
↓
Order status is updated
↓
Order is completed
```

---

## 7. Database Design

---

### 7.1 users

Stores all platform users.

```txt
id
name
email
phone
password
role
restaurant_id nullable
status
last_login_at
created_at
updated_at
```

#### Role Values

```txt
super_admin
restaurant_admin
waiter
kitchen
manager
```

---

### 7.2 restaurants

Stores restaurant business information.

```txt
id
owner_user_id
name
slug
email
phone
whatsapp_number
address
city
state
logo
cover_image
theme_color
description
status
subscription_status
trial_ends_at
created_at
updated_at
```

#### Status Values

```txt
active
inactive
suspended
```

#### Subscription Status Values

```txt
trial
active
expired
cancelled
```

---

### 7.3 restaurant_settings

Stores restaurant-specific configuration.

```txt
id
restaurant_id
currency
tax_enabled
tax_percentage
service_charge_enabled
service_charge_percentage
whatsapp_order_enabled
online_order_enabled
table_order_enabled
takeaway_enabled
delivery_enabled
custom_domain
branding_enabled
footer_text
created_at
updated_at
```

---

### 7.4 subscription_plans

Stores platform pricing plans.

```txt
id
name
price
duration_days
restaurant_limit
menu_item_limit
table_limit
staff_limit
custom_domain_allowed
whatsapp_order_allowed
online_order_allowed
status
created_at
updated_at
```

---

### 7.5 subscriptions

Stores restaurant subscription history.

```txt
id
restaurant_id
plan_id
starts_at
ends_at
status
payment_id nullable
created_at
updated_at
```

#### Status Values

```txt
active
expired
cancelled
pending
```

---

### 7.6 payments

Stores payment records.

```txt
id
restaurant_id
subscription_id nullable
amount
payment_method
razorpay_payment_id
razorpay_order_id
payment_status
paid_at
created_at
updated_at
```

#### Payment Status Values

```txt
pending
success
failed
refunded
```

---

### 7.7 branches

For future multi-branch restaurants.

```txt
id
restaurant_id
name
address
phone
manager_name
status
created_at
updated_at
```

---

### 7.8 dining_tables

Do not name this table `tables`.

```txt
id
restaurant_id
branch_id nullable
table_name
table_code
qr_code_path
status
created_at
updated_at
```

Example:

```txt
Table 1
Table 2
VIP Table
Garden Table
```

---

### 7.9 menu_categories

Stores food categories.

```txt
id
restaurant_id
name
slug
image nullable
sort_order
status
created_at
updated_at
```

Examples:

```txt
Starters
Main Course
Breads
Rice
Beverages
Desserts
```

---

### 7.10 menu_items

Stores food items.

```txt
id
restaurant_id
category_id
name
slug
description
image
price
discount_price nullable
food_type
is_available
is_featured
preparation_time nullable
sort_order
created_at
updated_at
```

#### Food Type Values

```txt
veg
non_veg
egg
```

---

### 7.11 orders

Stores customer orders.

```txt
id
restaurant_id
table_id nullable
order_number
customer_name nullable
customer_phone nullable
order_type
subtotal
tax_amount
service_charge
discount_amount
total_amount
special_instruction nullable
status
payment_status
created_at
updated_at
```

#### Order Type Values

```txt
dine_in
takeaway
delivery
whatsapp
```

#### Order Status Values

```txt
pending
accepted
preparing
ready
served
completed
rejected
cancelled
```

#### Payment Status Values

```txt
unpaid
paid
failed
refunded
```

---

### 7.12 order_items

Stores individual ordered items.

```txt
id
order_id
menu_item_id
item_name
quantity
price
total_price
special_instruction nullable
created_at
updated_at
```

---

### 7.13 staff

Stores restaurant staff profile.

```txt
id
restaurant_id
user_id
staff_type
phone
status
created_at
updated_at
```

#### Staff Type Values

```txt
waiter
kitchen
manager
```

---

### 7.14 qr_codes

Stores QR code data.

```txt
id
restaurant_id
table_id nullable
qr_type
qr_value
qr_image_path
created_at
updated_at
```

#### QR Type Values

```txt
restaurant
table
whatsapp
review
```

---

### 7.15 activity_logs

Stores important user activities.

```txt
id
user_id nullable
restaurant_id nullable
action
description
ip_address
created_at
updated_at
```

---

## 8. Laravel Folder Structure

```txt
app/
├── Http/
│   ├── Controllers/
│   │   ├── SuperAdmin/
│   │   │   ├── DashboardController.php
│   │   │   ├── RestaurantController.php
│   │   │   ├── PlanController.php
│   │   │   ├── SubscriptionController.php
│   │   │   ├── PaymentController.php
│   │   │   └── SettingController.php
│   │   │
│   │   ├── RestaurantAdmin/
│   │   │   ├── DashboardController.php
│   │   │   ├── ProfileController.php
│   │   │   ├── MenuCategoryController.php
│   │   │   ├── MenuItemController.php
│   │   │   ├── DiningTableController.php
│   │   │   ├── OrderController.php
│   │   │   ├── StaffController.php
│   │   │   ├── QRCodeController.php
│   │   │   ├── ReportController.php
│   │   │   └── SettingController.php
│   │   │
│   │   ├── Staff/
│   │   │   └── OrderController.php
│   │   │
│   │   ├── Customer/
│   │   │   ├── MenuController.php
│   │   │   └── OrderController.php
│   │   │
│   │   └── Auth/
│   │
│   ├── Middleware/
│   │   ├── RoleMiddleware.php
│   │   ├── RestaurantActiveMiddleware.php
│   │   └── SubscriptionActiveMiddleware.php
│
├── Models/
│   ├── User.php
│   ├── Restaurant.php
│   ├── RestaurantSetting.php
│   ├── SubscriptionPlan.php
│   ├── Subscription.php
│   ├── Payment.php
│   ├── Branch.php
│   ├── DiningTable.php
│   ├── MenuCategory.php
│   ├── MenuItem.php
│   ├── Order.php
│   ├── OrderItem.php
│   ├── Staff.php
│   ├── QRCode.php
│   └── ActivityLog.php
│
├── Services/
│   ├── QRCodeService.php
│   ├── RazorpayService.php
│   ├── SubscriptionService.php
│   ├── OrderService.php
│   ├── ReportService.php
│   └── ImageUploadService.php
```

---

## 9. View Structure

```txt
resources/views/
├── layouts/
│   ├── super-admin.blade.php
│   ├── restaurant-admin.blade.php
│   ├── staff.blade.php
│   └── customer.blade.php
│
├── components/
│   ├── button.blade.php
│   ├── input.blade.php
│   ├── card.blade.php
│   ├── stat-card.blade.php
│   ├── badge.blade.php
│   ├── modal.blade.php
│   ├── table.blade.php
│   └── toast.blade.php
│
├── super-admin/
│   ├── dashboard.blade.php
│   ├── restaurants/
│   ├── plans/
│   ├── subscriptions/
│   ├── payments/
│   └── settings/
│
├── restaurant-admin/
│   ├── dashboard.blade.php
│   ├── profile/
│   ├── categories/
│   ├── menu-items/
│   ├── tables/
│   ├── qr-codes/
│   ├── orders/
│   ├── staff/
│   ├── reports/
│   └── settings/
│
├── staff/
│   └── orders/
│
├── customer/
│   ├── menu.blade.php
│   ├── cart.blade.php
│   └── order-success.blade.php
│
└── auth/
```

---

## 10. Route Structure

---

### 10.1 Super Admin Routes

```php
Route::middleware(['auth', 'role:super_admin'])
    ->prefix('super-admin')
    ->name('super-admin.')
    ->group(function () {
        Route::get('/dashboard', [DashboardController::class, 'index'])->name('dashboard');
        Route::resource('/restaurants', RestaurantController::class);
        Route::resource('/plans', PlanController::class);
        Route::resource('/subscriptions', SubscriptionController::class);
        Route::resource('/payments', PaymentController::class);
        Route::get('/settings', [SettingController::class, 'index'])->name('settings.index');
        Route::post('/settings', [SettingController::class, 'update'])->name('settings.update');
    });
```

---

### 10.2 Restaurant Admin Routes

```php
Route::middleware(['auth', 'role:restaurant_admin', 'restaurant.active', 'subscription.active'])
    ->prefix('restaurant-admin')
    ->name('restaurant-admin.')
    ->group(function () {
        Route::get('/dashboard', [DashboardController::class, 'index'])->name('dashboard');

        Route::get('/profile', [ProfileController::class, 'edit'])->name('profile.edit');
        Route::post('/profile', [ProfileController::class, 'update'])->name('profile.update');

        Route::resource('/categories', MenuCategoryController::class);
        Route::resource('/menu-items', MenuItemController::class);
        Route::resource('/tables', DiningTableController::class);
        Route::resource('/orders', OrderController::class);
        Route::resource('/staff', StaffController::class);

        Route::get('/qr-codes', [QRCodeController::class, 'index'])->name('qr-codes.index');
        Route::post('/qr-codes/generate', [QRCodeController::class, 'generate'])->name('qr-codes.generate');

        Route::get('/reports', [ReportController::class, 'index'])->name('reports.index');

        Route::get('/settings', [SettingController::class, 'index'])->name('settings.index');
        Route::post('/settings', [SettingController::class, 'update'])->name('settings.update');
    });
```

---

### 10.3 Staff Routes

```php
Route::middleware(['auth', 'role:waiter,kitchen,manager'])
    ->prefix('staff')
    ->name('staff.')
    ->group(function () {
        Route::get('/orders', [StaffOrderController::class, 'index'])->name('orders.index');
        Route::get('/orders/{order}', [StaffOrderController::class, 'show'])->name('orders.show');
        Route::post('/orders/{order}/status', [StaffOrderController::class, 'updateStatus'])->name('orders.status');
    });
```

---

### 10.4 Customer Public Routes

```php
Route::get('/menu/{restaurant_slug}', [CustomerMenuController::class, 'show'])->name('customer.menu');
Route::get('/menu/{restaurant_slug}/table/{table_code}', [CustomerMenuController::class, 'showTableMenu'])->name('customer.table-menu');
Route::post('/menu/{restaurant_slug}/order', [CustomerOrderController::class, 'store'])->name('customer.order.store');
Route::get('/order-success/{order_number}', [CustomerOrderController::class, 'success'])->name('customer.order.success');
```

---

## 11. Model Relationships

---

### User Model

```txt
User belongsTo Restaurant nullable
User hasOne Staff nullable
```

---

### Restaurant Model

```txt
Restaurant belongsTo User as owner
Restaurant hasOne RestaurantSetting
Restaurant hasMany MenuCategory
Restaurant hasMany MenuItem
Restaurant hasMany DiningTable
Restaurant hasMany Order
Restaurant hasMany Staff
Restaurant hasMany Subscription
Restaurant hasMany Payment
Restaurant hasMany QRCode
```

---

### MenuCategory Model

```txt
MenuCategory belongsTo Restaurant
MenuCategory hasMany MenuItem
```

---

### MenuItem Model

```txt
MenuItem belongsTo Restaurant
MenuItem belongsTo MenuCategory
MenuItem hasMany OrderItem
```

---

### Order Model

```txt
Order belongsTo Restaurant
Order belongsTo DiningTable nullable
Order hasMany OrderItem
```

---

### OrderItem Model

```txt
OrderItem belongsTo Order
OrderItem belongsTo MenuItem
```

---

### DiningTable Model

```txt
DiningTable belongsTo Restaurant
DiningTable hasMany Order
DiningTable hasOne QRCode
```

---

## 12. Middleware

---

### 12.1 RoleMiddleware

Checks if the authenticated user has the required role.

Example:

```txt
role:super_admin
role:restaurant_admin
role:waiter,kitchen
```

---

### 12.2 RestaurantActiveMiddleware

Checks whether the restaurant is active.

If restaurant is inactive or suspended:

```txt
Redirect restaurant admin to blocked page
Show customer menu unavailable page
```

---

### 12.3 SubscriptionActiveMiddleware

Checks whether the restaurant subscription is active.

If subscription expired:

```txt
Restaurant admin sees renewal page
Customer menu shows temporarily unavailable page
Super admin can reactivate manually
```

---

## 13. QR Code System

---

### 13.1 QR Types

The platform must support:

```txt
Restaurant menu QR
Table-wise QR
WhatsApp order QR
Google review QR optional
```

---

### 13.2 Restaurant Menu QR

URL format:

```txt
https://yourdomain.com/menu/{restaurant_slug}
```

---

### 13.3 Table-Wise QR

URL format:

```txt
https://yourdomain.com/menu/{restaurant_slug}/table/{table_code}
```

When a customer scans this QR:

```txt
Restaurant is detected from restaurant_slug
Table is detected from table_code
Order is attached to that table
```

---

### 13.4 QR Code Requirements

Each QR code should be:

```txt
Generated as PNG
Stored in public/storage/qrcodes
Downloadable from admin panel
Printable for restaurant use
Regeneratable when needed
```

---

## 14. Customer Menu Functionality

The customer menu must be **mobile-first**.

---

### 14.1 Customer Menu Header

Show:

```txt
Restaurant cover image
Restaurant logo
Restaurant name
Address
Short description
Open/closed badge optional
```

---

### 14.2 Category Navigation

Use:

```txt
Horizontal scroll category tabs
Sticky category bar optional
Active category highlight
```

---

### 14.3 Food Item Card

Each food item card should show:

```txt
Food image
Food name
Veg / non-veg / egg indicator
Description
Price
Discount price if available
Add to cart button
Availability status
```

---

### 14.4 Cart System

Cart should support:

```txt
Add item
Remove item
Increase quantity
Decrease quantity
Item-wise instruction
Order-level instruction
Subtotal calculation
Tax calculation
Service charge calculation
Final total calculation
```

Use localStorage for temporary cart before order submission.

---

### 14.5 Sticky Cart Button

On mobile, show sticky bottom cart bar:

```txt
2 items | ₹430 | View Cart
```

---

### 14.6 Order Placement

When customer places order:

```txt
Validate restaurant
Validate active subscription
Validate table if table QR
Validate menu item availability
Create order
Create order items
Clear cart
Redirect to success page
```

---

## 15. Order Management

---

### 15.1 Order Status Flow

```txt
pending
↓
accepted
↓
preparing
↓
ready
↓
served
↓
completed
```

Alternative flows:

```txt
pending → rejected
pending → cancelled
```

---

### 15.2 Restaurant Order Dashboard

Restaurant admin should see:

```txt
New orders
Pending orders
Preparing orders
Ready orders
Completed orders
Cancelled orders
```

Each order card should show:

```txt
Order number
Table number
Customer details if available
Food items
Quantity
Total amount
Special instruction
Order time
Status
Action buttons
```

---

### 15.3 Staff Order Dashboard

Staff should see a simplified order view:

```txt
Order number
Table number
Items
Instructions
Status update button
```

Use large buttons for mobile.

---

## 16. WhatsApp Order Functionality

If WhatsApp ordering is enabled, create a WhatsApp message.

### Example Message

```txt
Hello, I want to place an order.

Restaurant: Aadya Palace
Table: Table 5

Items:
1. Paneer Butter Masala x 1 - ₹220
2. Butter Naan x 2 - ₹80

Subtotal: ₹300
Tax: ₹15
Total: ₹315

Instruction: Less spicy
```

### WhatsApp Link Format

```txt
https://wa.me/{restaurant_whatsapp_number}?text={encoded_message}
```

---

## 17. Subscription System

---

### 17.1 Plan Examples

#### Basic Plan

```txt
Price: ₹999/month
Menu Items: 50
Tables: 10
Staff: 2
WhatsApp Ordering: Yes
Custom Domain: No
```

#### Premium Plan

```txt
Price: ₹1999/month
Menu Items: 200
Tables: 50
Staff: 10
Order Dashboard: Yes
QR Download: Yes
Custom Domain: No
```

#### Enterprise Plan

```txt
Price: ₹4999/month
Menu Items: Unlimited
Tables: Unlimited
Staff: Unlimited
Custom Domain: Yes
Priority Support: Yes
Multiple Branches: Future Ready
```

---

### 17.2 Subscription Expiry Rules

If subscription expires:

```txt
Restaurant admin can login
Restaurant admin sees renewal message
Customer menu shows unavailable message
Orders cannot be placed
Super admin can manually extend subscription
```

---

## 18. Razorpay Payment Integration

---

### 18.1 Required Environment Variables

```env
RAZORPAY_KEY=
RAZORPAY_SECRET=
```

---

### 18.2 Payment Flow

```txt
Restaurant admin selects plan
System creates Razorpay order
Razorpay checkout opens
User completes payment
Payment verification happens
Payment record is saved
Subscription is activated
Invoice data is saved
```

---

### 18.3 Payment Security

Always verify Razorpay signature before activating subscription.

Store:

```txt
razorpay_order_id
razorpay_payment_id
payment_status
amount
paid_at
```

---

## 19. Reports

---

### 19.1 Restaurant Reports

Restaurant admin should see:

```txt
Today revenue
Today orders
Monthly revenue
Monthly orders
Best-selling items
Pending orders
Completed orders
Cancelled orders
Average order value
```

---

### 19.2 Super Admin Reports

Super admin should see:

```txt
Total restaurants
Active restaurants
Expired subscriptions
Monthly platform revenue
Total payments
Pending payments
Top restaurants by revenue
```

---

## 20. UI / UX Design Guide

---

### 20.1 Design Style

The full project should look like a modern SaaS product.

Use:

```txt
Clean layout
Premium dashboard
Soft shadows
Rounded cards
Modern typography
Minimal colors
Responsive spacing
Large clickable buttons
Professional tables
Status badges
Smooth hover effects
```

---

### 20.2 Color Palette

```txt
Primary: #111827
Secondary: #F59E0B
Background: #F8FAFC
Card: #FFFFFF
Text Dark: #111827
Text Muted: #6B7280
Success: #10B981
Danger: #EF4444
Warning: #F59E0B
Border: #E5E7EB
```

---

### 20.3 Font

Use one of these:

```txt
Inter
Manrope
Poppins
```

Recommended:

```txt
Inter
```

---

### 20.4 Dashboard Layout

Desktop:

```txt
Left sidebar
Topbar
Main content area
Cards grid
Tables
Filters
```

Mobile:

```txt
Hamburger menu
Single-column cards
Responsive order cards
No horizontal scroll
Large action buttons
```

---

## 21. Reusable UI Components

Create reusable Blade components:

```txt
Button
Input
Textarea
Select
Card
Stat Card
Badge
Modal
Toast
Sidebar
Topbar
Data Table
Pagination
Image Upload
Empty State
Confirmation Dialog
Status Dropdown
```

---

## 22. Super Admin Dashboard Design

Show stat cards:

```txt
Total Restaurants
Active Restaurants
Expired Subscriptions
Monthly Revenue
Total Orders
Pending Payments
```

Show sections:

```txt
Recent Restaurants
Recent Payments
Expiring Subscriptions
```

Sidebar:

```txt
Dashboard
Restaurants
Plans
Subscriptions
Payments
Settings
Activity Logs
Logout
```

---

## 23. Restaurant Admin Dashboard Design

Show stat cards:

```txt
Today Orders
Today Revenue
Pending Orders
Completed Orders
Total Menu Items
Total Tables
```

Show order board:

```txt
Pending
Accepted
Preparing
Ready
Served
Completed
```

Sidebar:

```txt
Dashboard
Profile
Menu Categories
Menu Items
Tables & QR
Orders
Staff
Reports
Settings
Logout
```

---

## 24. Staff Panel Design

Staff panel must be simple and mobile-friendly.

Each order card should show:

```txt
Table number
Order number
Food items
Quantity
Instructions
Current status
Update status button
```

---

## 25. Customer Menu Design

Customer menu should feel like a mobile food ordering app.

Important features:

```txt
Fast loading
Beautiful food cards
Sticky cart
Horizontal categories
Search bar
Clear pricing
Easy add/remove buttons
Smooth checkout
```

Do not make customer menu look like an old website.

---

## 26. Validation Rules

---

### 26.1 Restaurant Validation

```txt
Name required
Email valid
Phone required
Slug unique
Logo image optional
Status required
```

---

### 26.2 Menu Category Validation

```txt
Name required
Slug unique per restaurant
Image optional
Status required
```

---

### 26.3 Menu Item Validation

```txt
Name required
Category required
Price required numeric
Discount price nullable numeric
Food type required
Image optional jpg/png/webp max 2MB
Availability required
```

---

### 26.4 Order Validation

```txt
Restaurant required
At least one order item required
Valid menu item IDs
Quantity minimum 1
Table code valid if table order
```

---

### 26.5 Staff Validation

```txt
Name required
Email unique
Phone required
Role required
Password required while creating
```

---

## 27. Security Requirements

Implement:

```txt
CSRF protection
Password hashing
Role-based middleware
Restaurant ownership checks
Subscription checks
Input validation
Image upload validation
File size validation
XSS protection
SQL injection protection via Eloquent
Secure payment verification
```

Important rule:

```txt
Every query in restaurant admin panel must filter by restaurant_id.
```

Example:

```php
MenuItem::where('restaurant_id', auth()->user()->restaurant_id)->get();
```

---

## 28. Image Upload Rules

Images should be:

```txt
jpg
jpeg
png
webp
max 2MB
compressed if possible
stored restaurant-wise
```

Storage example:

```txt
storage/app/public/restaurants/{restaurant_id}/menu-items/
storage/app/public/restaurants/{restaurant_id}/logos/
storage/app/public/restaurants/{restaurant_id}/qrcodes/
```

---

## 29. Services Layer

Create services to keep controllers clean.

---

### 29.1 QRCodeService

Responsibilities:

```txt
Generate restaurant QR
Generate table QR
Store QR image
Return QR image path
Regenerate QR
```

---

### 29.2 OrderService

Responsibilities:

```txt
Validate cart
Calculate subtotal
Calculate tax
Calculate service charge
Create order
Create order items
Generate order number
Update order status
```

---

### 29.3 SubscriptionService

Responsibilities:

```txt
Check active subscription
Activate subscription
Expire subscription
Extend subscription
Check plan limits
```

---

### 29.4 RazorpayService

Responsibilities:

```txt
Create Razorpay order
Verify payment signature
Save payment details
Activate subscription after payment
```

---

### 29.5 ImageUploadService

Responsibilities:

```txt
Validate image
Resize image
Compress image
Store image
Delete old image
Return image path
```

---

## 30. Seeder Requirements

Create seeders for:

```txt
Super admin user
Demo restaurant
Restaurant admin user
Demo categories
Demo menu items
Demo dining tables
Subscription plans
Restaurant settings
```

Default super admin:

```txt
Email: admin@example.com
Password: password123
```

Demo restaurant:

```txt
Name: Aadya Palace
Slug: aadya-palace
Phone: 7800118200
City: Varanasi
Theme Color: #D4AF37
```

Demo categories:

```txt
Starters
Main Course
Breads
Rice
Beverages
Desserts
```

Demo menu items:

```txt
Paneer Tikka
Veg Biryani
Butter Naan
Dal Makhani
Cold Coffee
Gulab Jamun
```

---

## 31. Development Phases

Build the project in phases.

---

### Phase 1: Base Setup

```txt
Install Laravel
Configure database
Install Tailwind CSS
Setup authentication
Create role system
Create base layouts
```

---

### Phase 2: Database & Models

```txt
Create migrations
Create models
Create relationships
Create seeders
Run migrate and seed
```

---

### Phase 3: Super Admin Panel

```txt
Dashboard
Restaurant CRUD
Plan CRUD
Subscription management
Payment listing
Settings
```

---

### Phase 4: Restaurant Admin Panel

```txt
Dashboard
Profile update
Category CRUD
Menu item CRUD
Table CRUD
QR generation
Staff CRUD
Settings
```

---

### Phase 5: Customer Menu

```txt
Public menu page
Table-wise QR menu
Category filter
Search
Cart
Order placement
Success page
WhatsApp order
```

---

### Phase 6: Order Management

```txt
Restaurant order dashboard
Order status update
Staff order panel
Order filters
Order details
```

---

### Phase 7: Subscription & Payment

```txt
Plan selection
Razorpay checkout
Payment verification
Subscription activation
Expiry handling
```

---

### Phase 8: Reports & Polish

```txt
Restaurant reports
Super admin reports
Mobile responsiveness
UI polish
Security testing
Speed optimization
```

---

## 32. README Installation Guide

The final project must include a README with this flow.

```bash
composer install
npm install
cp .env.example .env
php artisan key:generate
php artisan migrate --seed
php artisan storage:link
npm run build
php artisan serve
```

---

## 33. Environment Variables

```env
APP_NAME="Smart QR Menu"
APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_URL=http://localhost:8000

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=smart_qr_menu
DB_USERNAME=root
DB_PASSWORD=

RAZORPAY_KEY=
RAZORPAY_SECRET=
```

---

## 34. Production Deployment Notes

For production:

```txt
Use VPS
Use Nginx
Use PHP-FPM
Use MySQL
Set APP_DEBUG=false
Set correct APP_URL
Run npm run build
Run php artisan config:cache
Run php artisan route:cache
Run php artisan view:cache
Setup SSL
Setup daily database backup
Setup storage permission
```

Production commands:

```bash
php artisan config:cache
php artisan route:cache
php artisan view:cache
php artisan optimize
```

---

## 35. Performance Requirements

Customer menu must be fast.

Use:

```txt
Compressed images
Lazy loading
Minimal JavaScript
Optimized queries
Pagination in dashboards
Indexes on restaurant_id
Cache settings where useful
```

Database indexes should be added on:

```txt
restaurant_id
slug
table_code
order_number
status
created_at
```

---

## 36. Testing Checklist

Before final delivery, test:

```txt
Super admin login
Restaurant creation
Restaurant admin login
Category CRUD
Menu item CRUD
Image upload
Table creation
QR generation
QR scan URL
Customer menu
Cart
Order placement
Order dashboard
Staff status update
Subscription expiry
Razorpay test payment
Mobile responsiveness
Restaurant data separation
```

---

## 37. Important Development Rules

Follow these strictly:

```txt
Do not write all logic in routes.
Use controllers.
Use models and relationships.
Use service classes for business logic.
Use middleware for access control.
Use validation request classes where possible.
Use reusable Blade components.
Keep UI premium and modern.
Use restaurant_id separation everywhere.
Make customer menu mobile-first.
Do not expose private data between restaurants.
Do not build an old-style admin panel.
```

---

## 38. Future Advanced Features

Keep architecture ready for:

```txt
Custom domain
Multiple branches
Kitchen display screen
Thermal printer integration
POS billing
Customer feedback
Google review QR
Coupon system
Loyalty points
Online customer payment
Delivery management
Inventory management
PWA
Mobile app API
Restaurant analytics
```

---

## 39. Final Expected Output

The final project should include:

```txt
Complete Laravel project
Database migrations
Seeders
Models with relationships
Controllers
Services
Middleware
Blade views
Tailwind CSS UI
Reusable components
Super admin dashboard
Restaurant admin dashboard
Staff panel
Customer QR menu
QR code generation
Order management
Subscription system
Razorpay-ready payment setup
README file
```

---

## 40. Final Quality Standard

The software should feel like a real SaaS product.

Final result must be:

```txt
Modern
Premium
Fast
Mobile responsive
Secure
Scalable
White-label ready
Easy to sell to restaurants
Easy for restaurant owners to use
Easy for customers to order
```

---

# Short Claude Prompt

Use this if a short instruction is needed:

```txt
Create a complete Laravel + MySQL + Tailwind CSS white-label Restaurant QR Menu and Order Management SaaS. It must include Super Admin, Restaurant Admin, Staff, and Customer QR menu flows. Build role-based dashboards, restaurant-wise data separation using restaurant_id, menu/category/item management, table-wise QR generation, mobile-first customer menu, cart and order placement, restaurant order dashboard, staff order panel, subscription plans, Razorpay integration structure, reports, seeders, README, and modern SaaS UI. Use controllers, models, services, middleware, migrations, reusable Blade components, validation, and clean scalable code. Make it production-ready and white-label ready.
```
