# Taxi backend — Phase 1

Laravel 12 API foundation for the native taxi platform.

## Current scope

- Laravel Sanctum mobile token authentication.
- Customer, driver, and admin roles.
- Public ULID identifiers for domain records.
- Customer and driver registration, including a pending driver application and vehicle.
- Driver status/online fields.
- Driver groups and many-to-many memberships.
- Stable API response envelope and role middleware.
- Initial feature tests for registration, driver onboarding, login, profile, and logout.
- Phase 2 trip engine: backend fare quotes, immediate/scheduled trip creation, global/group/specific-driver scopes, driver request listing, concurrency-safe acceptance, rejection, lifecycle commands, cancellation, and status history.

## Run locally

```bash
composer install
cp .env.example .env
php artisan key:generate
php artisan migrate
php artisan test
```

Use PostgreSQL for the intended environment. The current machine does not have the PHP SQLite PDO driver, so the default generated SQLite database cannot run migrations or feature tests here until a database driver/service is configured.

API base path: `/api/v1`.

## Phase 2 trip endpoints

```text
POST /customer/fare-quotes
POST /customer/trips
GET  /customer/trips/{trip}
POST /customer/trips/{trip}/cancel

GET  /driver/requests
POST /driver/trips/{trip}/accept
POST /driver/trips/{trip}/reject
POST /driver/trips/{trip}/en-route
POST /driver/trips/{trip}/arrive
POST /driver/trips/{trip}/start
POST /driver/trips/{trip}/complete
POST /driver/trips/{trip}/cancel
```

The current routing provider is a deliberately replaceable Haversine fallback. It is suitable for rough estimates and development only; road routing and traffic-aware ETA belong behind the same provider contract in a later integration.
