How felikstksimanjuntak/sirega works
Purpose and Runtime
This is a Laravel/PHP application for managing sports-field (Lapangan) reservations (Reservasi). It provides server-rendered member and admin workflows plus a separate JSON API. Laravel’s HTTP runtime starts at public/index.php, bootstraps through bootstrap/app.php, and uses routes in routes/web.php and routes/api.php.
HTTP Entry Points and Route Surfaces
Web routes drive the Blade UI: authentication, member reservation creation/history, and administrative field/reservation operations. API routes expose authentication and field data/actions independently of the browser UI.
• routes/web.php
• routes/api.php
• app/Http/Controllers/AuthController.php
• app/Http/Controllers/Api/AuthController.php
Identity, Authentication, and Authorization
User is the shared identity model, extended by a role migration. Browser authentication is handled separately from API authentication; Sanctum configuration and personal-access-token migration indicate token-based API access. Role-based request gating is centralized in custom middleware, forming the primary admin/member boundary.
• app/Models/User.php
• app/Http/Middleware/RoleMiddleware.php
• config/sanctum.php
• database/migrations/2026_07_16_070335_add_role_to_users_table.php
Reservation Domain and Persistence
The core relational domain is users, fields, and reservations. Eloquent models encapsulate these entities; migrations establish the database schema. Reservations are therefore expected to link a user’s booking activity to a selected field, with controllers coordinating lifecycle operations.
• app/Models/Lapangan.php
• app/Models/Reservasi.php
• database/migrations/2026_07_16_070416_create_lapangans_table.php
• database/migrations/2026_07_16_070443_create_reservasis_table.php
Member Reservation Flow
A member-facing controller receives reservation requests, validates them through a dedicated form request, persists through the reservation model, and returns member Blade pages for creation and reservation history. This is the principal booking path.
• app/Http/Controllers/ReservasiController.php
• app/Http/Requests/ReservasiRequest.php
• resources/views/member/reservasi/create.blade.php
• resources/views/member/reservasi/index.blade.php
Administrative Operations and Reporting
Admins manage field inventory and oversee reservations through distinct controllers. Field create/update input is validated by LapanganRequest. Reservation administration includes list, receipt (kwitansi), and report views, making this the operational/reporting boundary rather than a separate service.
• app/Http/Controllers/LapanganController.php
• app/Http/Controllers/AdminReservasiController.php
• app/Http/Requests/LapanganRequest.php
• resources/views/admin/reservasi/laporan.blade.php
API Contract Layer
API controllers parallel web capabilities without rendering views. LapanganResource is an explicit response-shaping boundary for field payloads, separating external JSON representation from Eloquent models.
• app/Http/Controllers/Api/LapanganController.php
• app/Http/Resources/LapanganResource.php
• app/Http/Controllers/Api/AuthController.php
Infrastructure and Delivery Boundaries
Laravel configuration supports database, sessions, cache, filesystems, logging, mail, and queues; concrete backing services are environment-selected rather than specified by the repository. Database setup includes cache and job tables, and seeded users support initial role-based access. Front-end assets are compiled with Vite and rendered by Blade layouts.
• config/database.php
• config/queue.php
• database/seeders/UserSeeder.php
• resources/views/layouts/app.blade.php
Main entry points: ReservasiController.php Member Reservations · web.php Web Routes · Reservasi.php Reservasi · Lapangan.php Lapangan
Components 23
Laravel Runtime
- HTTP Entry
public/index.php - Application Bootstrap
bootstrap/app.php - Web Routes · Browser UI and operational routes.
routes/web.php - Blade Layout
resources/views/layouts/app.blade.php
Identity & Access
- User · Shared browser and API identity.
app/Models/User.php - Role Middleware · Primary admin/member request boundary.
app/Http/Middleware/RoleMiddleware.php - Sanctum
config/sanctum.php - User Role Schema
database/migrations/2026_07_16_070335_add_role_to_users_table.php
Reservation Domain
- Lapangan · Sports-field inventory.
app/Models/Lapangan.php - Reservasi · Booking linking a user and field.
app/Models/Reservasi.php - Reservation Schema · Creates field and reservation tables.
database/migrations/2026_07_16_070443_create_reservasis_table.php - Member Reservations · Creates and lists a member's bookings.
app/Http/Controllers/ReservasiController.php - Reservation Validation
app/Http/Requests/ReservasiRequest.php - Booking Form
resources/views/member/reservasi/create.blade.php - Reservation History
resources/views/member/reservasi/index.blade.php
Administration
- Field Administration
app/Http/Controllers/LapanganController.php - Field Validation
app/Http/Requests/LapanganRequest.php - Reservation Operations · Admin list, receipt, and reporting operations.
app/Http/Controllers/AdminReservasiController.php - Reservation Report
resources/views/admin/reservasi/laporan.blade.php
JSON API
- API Routes · Independent JSON endpoints.
routes/api.php - API Authentication
app/Http/Controllers/Api/AuthController.php - Field API
app/Http/Controllers/Api/LapanganController.php - Field JSON Resource · Shapes external field payloads.
app/Http/Resources/LapanganResource.php
Connections 30
- HTTP Entry → Application Bootstrap: boots
- Application Bootstrap → Web Routes: loads
- Application Bootstrap → API Routes: loads
- Web Routes → Role Middleware: gates roles
- Web Routes → Member Reservations: member endpoints
- Web Routes → Field Administration: admin endpoints
- Web Routes → Reservation Operations: admin endpoints
- Role Middleware → User: checks role
- User Role Schema → User: adds role
- Member Reservations → Reservation Validation: validates
- Member Reservations → Reservasi: creates and queries
- Member Reservations → Lapangan: selects field
- Member Reservations → Booking Form: renders
- Member Reservations → Reservation History: renders
- Field Administration → Field Validation: validates
- Field Administration → Lapangan: manages
- Reservation Operations → Reservasi: oversees
- Reservation Operations → Reservation Report: renders report
- Reservation Schema → Lapangan: persists
- Reservation Schema → Reservasi: persists
- Reservasi → User: belongs to
- Reservasi → Lapangan: belongs to
- API Routes → API Authentication: auth endpoints
- API Routes → Field API: field endpoints
- API Authentication → Sanctum: issues tokens
- API Authentication → User: authenticates
- Field API → Lapangan: queries
- Field API → Field JSON Resource: serializes
- Blade Layout → Booking Form: wraps
- Blade Layout → Reservation Report: wraps