# Digital Menus (menus-digitaux)

Digital Menus is a modern web application designed for restaurants to create, manage, and display their digital menus. Built with **Laravel 12**, **Inertia.js 2.0**, and **Vue 3**, it provides a seamless user experience for both administrators and customers.

## Project Overview

- **Backend:** [Laravel 12.0](https://laravel.com/docs/12.x) with PHP 8.2+.
- **Frontend:** [Vue 3](https://vuejs.org/) (Composition API) integrated via [Inertia.js 2.0](https://inertiajs.com/).
- **Styling:** [Tailwind CSS 3.2.1](https://tailwindcss.com/) with Vite 7.0.
- **Authentication:** [Laravel Breeze](https://laravel.com/docs/12.x/starter-kits#laravel-breeze) (Inertia starter kit).
- **Core Features:**
    - **Admin Dashboard:** Manage menu items (plats), categories, and restaurant information.
    - **Menu Item Management:** CRUD operations for dishes, including image uploads and availability tracking.
    - **Public Menu View:** Publicly accessible menu pages via dynamic slugs (e.g., `/{slug}`).
    - **Table Management:** Support for linking tables to restaurant menus.

## Architecture

- **Models:**
    - `Restaurant`: Core entity representing a restaurant.
    - `Category`: Groups for menu items (e.g., Starters, Main Course, Drinks).
    - `Item`: Represents a menu dish (Plat). Includes name, price, ingredients, and image path.
    - `Table`: Represents physical tables in a restaurant.
    - `User`: Handles authentication and administration.
- **Controllers:**
    - `Admin/ItemController`: Manages the administrative logic for menu items.
    - `MenuController`: Handles the public display of restaurant menus.
- **Routing:**
    - Admin routes are prefixed with `/admin` and protected by `auth` middleware.
    - Public restaurant menus are accessed via a top-level slug route `/{slug}`.

## Building and Running

### Prerequisites
- PHP 8.2+
- Node.js & NPM
- Composer
- SQLite (or another database configured in `.env`)

### Setup and Installation
The project includes a custom setup script in `composer.json`:
```powershell
composer setup
```
This script will:
1. Install PHP and NPM dependencies.
2. Create the `.env` file from `.env.example`.
3. Generate the application key.
4. Run database migrations.
5. Build the frontend assets.

### Development
For active development, use the following command to run the Laravel server, Vite, and background processes concurrently:
```powershell
composer dev
```
Alternatively, run them separately:
```powershell
php artisan serve
npm run dev
```

### Testing
Run the PHPUnit test suite:
```powershell
composer test
```

## Development Conventions

- **PHP Style:** Follow PSR-12 coding standards. Use Laravel's expressive syntax (Eloquent, Blade-like Vue templates).
- **Frontend:**
    - Use Vue 3 Composition API with `<script setup>`.
    - Leverage Inertia.js for navigation and data passing between Laravel and Vue.
    - Utilize Tailwind CSS for all styling to maintain consistency.
- **Naming Conventions:**
    - Controllers: `SomethingController.php`.
    - Models: `Something.php` (Singular).
    - Migrations: `YYYY_MM_DD_XXXXXX_create_somethings_table.php` (Plural).
    - Routes: Use named routes for all internal links (e.g., `admin.items.index`).
- **File Uploads:** Menu item images are stored in `storage/app/public/plats` and linked via `public/storage`. Ensure `php artisan storage:link` is run during setup.

## Key Files
- `app/Models/Item.php`: Core model for menu items.
- `app/Http/Controllers/Admin/ItemController.php`: Admin logic for menu items.
- `resources/js/Pages/Admin/Items/Create.vue`: Frontend form for adding menu items.
- `routes/web.php`: Primary web routes including admin and public menu logic.
- `composer.json` & `package.json`: Dependency and script management.
