Update README for SQLite-first setup
This commit is contained in:
@@ -1,5 +1,85 @@
|
||||
# CanteenHub - Multi-User Collaborative Canteen & Food Ordering System
|
||||
|
||||
A zero‑framework PHP application that uses **SQLite** as its default database. It replaces informal chat‑based lunch ordering threads with a structured web interface.
|
||||
|
||||
---
|
||||
|
||||
## Key Features
|
||||
|
||||
1. **User Authentication** – Login `/login` & Register `/register` with password hashing. Pre‑seeded demo accounts (password: `password`).
|
||||
2. **Session Creation** – Any user can start a food session, paste menu items, and invite colleagues.
|
||||
3. **Self‑Ordering** – Browse active sessions, select multiple items, set quantities and notes.
|
||||
4. **Bill Calculation** – Host enters final prices, app computes each participant’s bill and generates copy‑ready markdown.
|
||||
|
||||
---
|
||||
|
||||
## How to Run (SQLite)
|
||||
|
||||
### Option 1: PHP Built‑in Server
|
||||
```bash
|
||||
php -S localhost:8000 -t public
|
||||
```
|
||||
Visit `http://localhost:8000`.
|
||||
|
||||
### Option 2: Docker Compose
|
||||
```bash
|
||||
docker compose up -d --build
|
||||
```
|
||||
Visit `http://localhost:8080`.
|
||||
|
||||
### Option 3: Apache
|
||||
Point the VirtualHost `DocumentRoot` to the `public/` directory (rewrites handled by `public/.htaccess`).
|
||||
|
||||
---
|
||||
|
||||
## Database Setup (SQLite)
|
||||
|
||||
1. Copy the example env file and set SQLite configuration:
|
||||
```bash
|
||||
cp .env.example .env
|
||||
```
|
||||
Edit `.env`:
|
||||
```
|
||||
DB_CONNECTION=sqlite
|
||||
DB_DATABASE=storage/database.sqlite
|
||||
```
|
||||
2. Create the SQLite file and run the schema initialization (executed automatically on first request):
|
||||
```bash
|
||||
mkdir -p storage
|
||||
touch storage/database.sqlite
|
||||
php -r "require 'public/index.php'; App\\Core\\Database\\Database::initSchema();"
|
||||
```
|
||||
The `initSchema()` method creates all tables and seeds initial data if the database is empty.
|
||||
|
||||
### Resetting Data
|
||||
To start from a clean slate:
|
||||
```bash
|
||||
rm storage/database.sqlite
|
||||
mkdir -p storage
|
||||
touch storage/database.sqlite
|
||||
php -r "require 'public/index.php'; App\\Core\\Database\\Database::initSchema();"
|
||||
```
|
||||
Or invoke the built‑in reset:
|
||||
```bash
|
||||
php -r "require 'public/index.php'; App\\Core\\Database\\Database::initSchema();"
|
||||
```
|
||||
(Calling `initSchema()` drops existing tables and recreates them.)
|
||||
|
||||
---
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
- **Missing PDO SQLite extension** – Install via `sudo apt-get install php8.2-sqlite3`.
|
||||
- **File permission issues** – Ensure the web server user can read/write `storage/`.
|
||||
- **Database connection errors** – Verify `.env` settings and that `storage/database.sqlite` exists.
|
||||
|
||||
---
|
||||
|
||||
## License
|
||||
|
||||
MIT License. See `LICENSE` for details.
|
||||
|
||||
|
||||
A zero-framework PHP application built to replace informal Mattermost/chat lunch ordering threads. Anyone on the team can log in, start a food session, join any colleague's session, and place their own orders with automatic bill calculation upon food arrival.
|
||||
|
||||
---
|
||||
|
||||
Reference in New Issue
Block a user