2.2 KiB
2.2 KiB
TOURNAMENT PXG 2026 — Laravel API Skeleton (matches Vue frontend contract)
This is a Laravel API skeleton you can copy into an existing Laravel 10/11 project. It matches the frontend contract used by the Vue project:
Endpoints (v1)
GET /api/v1/events/{event}POST /api/v1/events/{event}/registrationsPOST /api/v1/events/{event}/groupsGET /api/v1/groups/{code}POST /api/v1/groups/{code}/joinPOST /api/v1/registrations/{registration}/payPOST /api/v1/pairing/lookupPOST /api/v1/pairing/otp/requestPOST /api/v1/pairing/otp/verifyGET /api/v1/pairing/me(Bearer pairing_token)POST /api/v1/webhooks/xendit
Environment variables (.env)
Add:
XENDIT_API_KEY=...XENDIT_WEBHOOK_TOKEN=...(the token you set in Xendit dashboard)WA_OTP_DRIVER=log(default) or your provider driver namePAIRING_TOKEN_TTL_MINUTES=30OTP_TTL_MINUTES=5
WhatsApp OTP
This skeleton provides an interface OtpSenderInterface + default driver LogOtpSender which writes OTP to logs.
Replace it with your WhatsApp Business API provider integration.
Xendit
This skeleton includes a minimal XenditService stub.
Replace createInvoice() with real Xendit Invoice API call and map the webhook payload accordingly.
Installation approach
- Create a fresh Laravel project (or use existing).
- Copy the
app/,routes/, anddatabase/migrations/from this skeleton into your project. - Run migrations:
php artisan migrate - Seed flights:
php artisan pxg:seed-flights --event=1 - Configure
.envand run:php artisan serve
Notes
- Pairing token is an encrypted bearer token (not Sanctum), issued after OTP verification.
- OTP uses hashing + rate-limits (basic) + attempt limits.
- Pairing assignment logic is NOT implemented here (you can plug your pairing job/service later).
The API returns pairing info only if a registration has been assigned to a flight via
flight_members.
Admin Dashboard (API)
- Login:
POST /api/v1/admin/loginwith email+password -> returns Sanctum token - Default seeded admin:
- email:
admin@pxg.local - password:
pxg2026adminRun:
- email:
php artisan db:seed --class=AdminUserSeeder