# ANNEWATT Connect - Laravel Backend

This is the PHP/Laravel backend for the ANNEWATT Connect platform, replacing the initial Supabase mock setup. It provides a complete API for managing transport association members, vehicles, registrations, and payments.

## Prerequisites
- **Docker Desktop**: The project is designed to run via Docker to ensure a consistent environment without needing local PHP/Composer installations.

## Getting Started

### 1. Database Setup
The project uses SQLite for simplicity. The database is stored at `database/database.sqlite`.

To run migrations and seed initial Edo State data:
```bash
docker run --rm -v "$(pwd):/app" -w /app composer php artisan migrate --seed --force
```

### 2. Running the Server
You can start the Laravel development server using Docker:
```bash
docker run -it --rm -v "$(pwd):/app" -w /app -p 8000:8000 php:8.2-cli php -S 0.0.0.0:8000 -t public
```
The API will be available at `http://localhost:8000/api`.

## API Endpoints

### Hierarchy
- `GET /api/states`: List all states.
- `GET /api/lgas?state_id={uuid}`: List LGAs for a state.
- `GET /api/units?lga_id={uuid}`: List units for an LGA.

### Members & Registrations
- `GET /api/members`: List all members with vehicles.
- `GET /api/registrations`: List all registration applications.
- `POST /api/registrations`: Submit a new registration.

### Payments
- `GET /api/payments`: List all payments.
- `POST /api/payments`: Record a new payment.

## Project Structure
- `app/Models/`: Eloquent models with UUID support.
- `database/migrations/`: Database schema definitions.
- `database/seeders/`: Initial data (Edo State LGAs and Units).
- `app/Http/Controllers/`: API logic.
- `routes/api.php`: API endpoint definitions.
