Skip to main content

Introduction

This quickstart guide walks you through the essential steps to get your restaurant site operational, from logging in as an admin to processing your first customer order.
Before starting, ensure you’ve completed the Installation guide and have the application running at http://localhost:8000

Overview

In this guide, you’ll:
  1. Log in as an admin user
  2. Create food categories
  3. Add menu items with details
  4. Test the customer ordering flow
  5. Manage orders in the admin panel

Step-by-Step Guide

1

Access the Application

Open your browser and navigate to the application:
http://localhost:8000
You should see the restaurant homepage with a navigation menu.
2

Log in as Admin

Click the Login button in the navigation menu and use the seeded admin credentials:
Email: [email protected]
Password: admin1234
After successful login, you’ll be redirected to the admin dashboard at /admin/dashboard.
The system uses Laravel Jetstream for authentication, which includes features like two-factor authentication and session management.
3

Explore the Admin Dashboard

The admin dashboard provides access to:
  • Users Management - Create and manage staff accounts
  • Food Menu - Add and edit menu items
  • Categories - Organize menu items
  • Tables - Manage restaurant tables
  • Reservations - Handle table bookings
  • Orders - View and process customer orders
  • Chefs - Manage chef profiles
Navigate through the sidebar to familiarize yourself with the interface.
4

Create Menu Categories

Before adding food items, create some categories:
  1. Go to Admin > Categories (or use the existing seeded categories)
  2. Click Add Category
  3. Create categories like:
    • Appetizers
    • Main Courses
    • Desserts
    • Beverages
    • Specials
Categories are automatically seeded during installation via CategorySeeder, but you can add more as needed.
5

Add Your First Menu Item

Now add a food item to the menu:
  1. Navigate to Admin > Foods in the sidebar
  2. Click Create Food or Add New Item
  3. Fill in the details:
Title: Grilled Salmon
Price: 24.99
Category: Main Courses
Description: Fresh Atlantic salmon grilled to perfection
Ingredients: Salmon, olive oil, lemon, herbs
Proteins: 35g
Calories: 450
Size: 250g
Image: Upload an image (optional)
  1. Click Save to create the item
The food item is stored in the food table:
Schema::create('food', function (Blueprint $table) {
    $table->id();
    $table->string("title")->nullable();
    $table->decimal('price', 8, 2)->nullable();
    $table->string("image")->nullable();
    $table->string("description")->nullable();
    $table->text('ingredients')->nullable();
    $table->string('proteins')->nullable();
    $table->integer('calories')->nullable();
    $table->string('size')->nullable();
    $table->foreignId('category_id')
          ->nullable()
          ->constrained('categories')
          ->onDelete('set null');
    $table->timestamps();
});
6

Add More Menu Items

Create a few more items to populate your menu:
Title: Caesar Salad
Price: 8.99
Category: Appetizers
Description: Classic Caesar with crispy romaine
Ingredients: Romaine lettuce, Caesar dressing, parmesan, croutons
Calories: 220
Size: Medium
7

Test the Customer Experience

Now test the ordering flow from a customer’s perspective:
  1. Log out from the admin account
  2. Register a new customer account or use the seeded customer:
    Email: [email protected]
    Password: user1234
    
  3. You’ll be redirected to the homepage
8

Browse the Menu

As a customer:
  1. Click Menu in the navigation
  2. Browse the food items you created
  3. Click on an item to view details
The menu view is powered by the comidaview route:
routes/web.php
Route::get('/menu', [HomeController::class, 'comidaview'])->name('menu');
HomeController.php
public function comidaview()
{
    $foods = Food::with('category')->paginate(24);
    $user = Auth::user();
    $count = $user ? Cart::where('user_id', $user->id)->count() : 0;
    
    return view('comidaview', compact('foods','count'));
}
9

Add Items to Cart

Select items and add them to your cart:
  1. Click on a food item (e.g., “Grilled Salmon”)
  2. View the detailed information
  3. Click Add to Cart
  4. The cart count in the navigation will update
The cart is managed through authenticated routes:
routes/web.php
Route::middleware(['auth'])->group(function () {
    Route::get('/cart', [CartController::class, 'index'])->name('cart.index');
    Route::post('/cart/{food}', [CartController::class, 'store'])->name('cart.store');
    Route::delete('/cart/{cart}', [CartController::class, 'destroy'])->name('cart.destroy');
});
Only authenticated users can add items to cart. Guest users will be redirected to login.
10

View and Update Cart

Check your cart:
  1. Click the Cart icon in the navigation
  2. Review the items and quantities
  3. Update quantities or remove items as needed
  4. See the total price update dynamically
11

Place an Order

Complete the checkout process:
  1. From the cart page, click Proceed to Checkout
  2. Fill in delivery details:
    Name: John Doe
    Phone: +1 (555) 123-4567
    Address: 123 Main St, Apt 4B, New York, NY 10001
    
  3. Review your order items
  4. Click Confirm Order
The order is processed by the orderConfirm method:
HomeController.php
public function orderConfirm(Request $request)
{
    $request->validate([
        'name' => 'required|string|max:255',
        'phone' => 'required|string|max:40',
        'address' => 'nullable|string',
    ]);
    
    $user = Auth::user();
    
    DB::beginTransaction();
    try {
        $order = Order::create([
            'user_id' => $user ? $user->id : null,
            'customer_name' => $request->name,
            'phone' => $request->phone,
            'address' => $request->address,
            'total' => 0,
            'status' => 'pending',
        ]);
        
        $total = 0;
        foreach ($normalized as $it) {
            $orderItem = $order->items()->create([
                'food_id' => $it['food_id'] ?? null,
                'title'   => $it['title'],
                'price'   => $it['price'],
                'quantity'=> $it['quantity'],
                'subtotal'=> $it['subtotal'],
            ]);
            $total += $it['subtotal'];
        }
        
        $order->update(['total' => $total]);
        
        // Clear cart items
        if ($user) {
            Cart::where('user_id', $user->id)->delete();
        }
        
        DB::commit();
        return redirect()->route('home')
            ->with('success', 'Order created successfully. ID: ' . $order->id);
    } catch (\Throwable $e) {
        DB::rollBack();
        return redirect()->back()
            ->with('error', 'Could not process order. Please try again.');
    }
}
Orders are created in a database transaction to ensure data consistency. If any part fails, all changes are rolled back.
12

View Orders as Admin

Switch back to the admin account to manage orders:
  1. Log out from the customer account
  2. Log in as admin ([email protected] / admin1234)
  3. Go to Admin > Orders
  4. You’ll see the order you just placed
  5. Click to view order details:
    • Customer information
    • Order items with quantities
    • Total amount
    • Order status (pending, preparing, delivered)
The orders route is protected by role middleware:
routes/web.php
Route::middleware('role:admin')->group(function () {
    Route::get('orders', [AdminOrderController::class, 'index'])
        ->name('orders.index');
    Route::get('orders/{order}', [AdminOrderController::class, 'show'])
        ->name('orders.show');
});
13

Test Other User Roles

Explore the different role capabilities:Chef Account ([email protected] / chef1234):
  • Access admin panel
  • Manage food menu items
  • View chef profile
  • Cannot access user management
routes/web.php
Route::middleware('role:admin,chef')->group(function () {
    Route::resource('foods', AdminFoodController::class)->names('foods');
});
Waiter Account ([email protected] / mesero1234):
  • Access admin panel
  • Manage tables and reservations
  • Assign tables to customers
  • Cannot manage menu items
routes/web.php
Route::middleware('role:admin,mesero')->group(function () {
    Route::resource('tables', AdminTableController::class)->names('tables');
    Route::get('reservations', [AdminReservationController::class, 'index']);
});
14

Manage Tables (Optional)

If you’re running a dine-in restaurant:
  1. Log in as admin or waiter
  2. Go to Admin > Tables
  3. Click Add Table
  4. Create tables:
    Table Number: 1
    Capacity: 4
    Status: Available
    Location: Window Side
    
  5. Repeat for multiple tables
  6. Update table status as customers arrive:
    • Available
    • Reserved
    • Occupied

Understanding the Data Flow

Order Processing Flow

Role-Based Access

The system uses Spatie Laravel Permission for role management:
User Model
use Spatie\Permission\Traits\HasRoles;

class User extends Authenticatable
{
    use HasRoles;
    
    // Check if user has a role
    if ($user->hasRole('admin')) {
        // Admin access
    }
    
    // Check multiple roles
    if ($user->hasAnyRole(['admin', 'chef', 'mesero'])) {
        // Access admin panel
    }
}

Database Relationships

// Food belongs to Category
Food::with('category')->get();

// Order has many OrderItems
$order = Order::with('items')->find(1);

// User has many Orders
$userOrders = User::find(1)->orders;

// Cart belongs to User and Food
$cartItems = Cart::with('food', 'user')->get();

Configuration Tips

Customize Application Name

Update your .env file:
.env
APP_NAME="My Restaurant Name"
VITE_APP_NAME="${APP_NAME}"

Set Application URL

.env
APP_URL=http://myrestaurant.test

Configure File Uploads

For food images, ensure storage is properly linked:
php artisan storage:link
Images are stored in storage/app/public/ and accessed via public/storage/.

Common Tasks

Create a New Admin User

php artisan tinker
$user = User::create([
    'name' => 'New Admin',
    'email' => '[email protected]',
    'password' => Hash::make('secure-password'),
    'usertype' => 'admin'
]);

$user->assignRole('admin');

Bulk Import Menu Items

Create a custom seeder:
database/seeders/MenuSeeder.php
use App\Models\Food;
use App\Models\Category;

class MenuSeeder extends Seeder
{
    public function run()
    {
        $appetizers = Category::where('name', 'Appetizers')->first();
        
        $items = [
            ['title' => 'Spring Rolls', 'price' => 6.99, 'calories' => 180],
            ['title' => 'Bruschetta', 'price' => 7.99, 'calories' => 150],
            ['title' => 'Calamari', 'price' => 9.99, 'calories' => 280],
        ];
        
        foreach ($items as $item) {
            Food::create([
                ...$item,
                'category_id' => $appetizers->id,
                'description' => 'Delicious ' . $item['title'],
            ]);
        }
    }
}
Run the seeder:
php artisan db:seed --class=MenuSeeder

Clear All Orders (Development)

php artisan tinker
Order::truncate();
OrderItem::truncate();
Cart::truncate();
Only use truncate in development. In production, use soft deletes or archive old orders.

Testing the API

If you plan to use the API endpoints:

Authenticate with Sanctum

curl -X POST http://localhost:8000/login \
  -H "Content-Type: application/json" \
  -d '{
    "email": "[email protected]",
    "password": "admin1234"
  }'

Fetch Menu Items

curl http://localhost:8000/api/foods \
  -H "Authorization: Bearer YOUR_TOKEN"

Next Steps

Now that you have a working restaurant site:

Authentication Guide

Deep dive into the multi-role authentication system

Menu Management

Learn advanced menu management features

Order Processing

Understand the complete order workflow

Configuration

Customize the configuration of your restaurant site

Troubleshooting

Issue: “Please login to add items to cart” messageSolution: Cart functionality requires authentication. Ensure you’re logged in:
// Cart routes require auth middleware
Route::middleware(['auth'])->group(function () {
    Route::post('/cart/{food}', [CartController::class, 'store']);
});
Issue: Order not created, transaction rolled backPossible Causes:
  • Missing required fields (name, phone)
  • Food item doesn’t exist
  • Database connection issue
Debug:
# Check Laravel logs
tail -f storage/logs/laravel.log

# Test database connection
php artisan db:show
Issue: Redirected when accessing admin routesSolution: Verify user has correct role assigned:
php artisan tinker
$user = User::where('email', '[email protected]')->first();
$user->roles; // Check assigned roles
$user->assignRole('admin'); // Assign role if missing
Issue: Food images showing broken linksSolution:
# Ensure storage is linked
php artisan storage:link

# Check file permissions
chmod -R 775 storage/app/public

# Verify image path in database
# Should be: storage/foods/filename.jpg
For production deployment, remember to:
  • Set APP_ENV=production
  • Set APP_DEBUG=false
  • Run php artisan config:cache
  • Run php artisan route:cache
  • Run php artisan view:cache
  • Use npm run build for optimized assets

Build docs developers (and LLMs) love