How debora1908/uas4sia_sirega works
Purpose and Entry Points
This is a Laravel/PHP application for managing sports fields (lapangan) and their reservations (reservasi), with both server-rendered browser workflows and JSON API endpoints. HTTP enters through public/index.php, boots via bootstrap/app.php, and is dispatched by routes/web.php, routes/api.php, and routes/auth.php.
HTTP Application Surfaces
Browser routes connect CRUD controllers to Blade pages:
• Field management: app/Http/Controllers/LapanganController.php → resources/views/lapangan/index.blade.php
• Reservation management, detail, and PDF view: app/Http/Controllers/ReservasiController.php → resources/views/reservasi/show.blade.php, resources/views/reservasi/pdf.blade.php
• Dashboard/profile/authenticated account flows: resources/views/dashboard.blade.php, app/Http/Controllers/ProfileController.php
The API is a separate controller surface for authentication, fields, and reservations: app/Http/Controllers/Api/AuthController.php, app/Http/Controllers/Api/LapanganApiController.php, and app/Http/Controllers/Api/ReservasiApiController.php.
Identity, Authentication, and Authorization
Laravel’s session-based browser authentication is implemented through controllers under app/Http/Controllers/Auth/ and route definitions in routes/auth.php. The user model is app/Models/User.php; migrations create users, add a role, and create personal access tokens in database/migrations/0001_01_01_000000_create_users_table.php, database/migrations/2026_07_16_072921_add_role_to_users_table.php, and database/migrations/2026_07_16_080416_create_personal_access_tokens_table.php.
Role enforcement is an application-specific boundary in app/Http/Middleware/RoleMiddleware.php. API token capabilities are configured through Laravel Sanctum (config/sanctum.php), supporting API authentication alongside web sessions.
Core Domain and Persistence
The primary domain is modeled by Eloquent:
• Sports-field inventory: app/Models/Lapangan.php
• Booking/reservation records: app/Models/Reservasi.php
• Users/roles: app/Models/User.php
Schema ownership resides in database/migrations/2026_07_16_070052_create_lapangans_table.php and database/migrations/2026_07_16_070102_create_reservasis_table.php. Controllers orchestrate requests against these models; Laravel’s database connection and transaction-capable persistence layer are configured in config/database.php.
Validation and Representation Boundaries
Field write operations use dedicated request validation objects: app/Http/Requests/StoreLapanganRequest.php and app/Http/Requests/UpdateLapanganRequest.php. Profile and login flows likewise isolate input validation in app/Http/Requests/ProfileUpdateRequest.php and app/Http/Requests/Auth/LoginRequest.php.
The API field payload is explicitly shaped through app/Http/Resources/LapanganResource.php, separating Eloquent persistence objects from public JSON representation.
Reservation Flow and Outputs
Reservation creation/editing follows the web controller → reservation model → database pattern, with forms at resources/views/reservasi/create.blade.php and resources/views/reservasi/edit.blade.php. Results are rendered as an index/detail UI or a PDF-oriented document view through resources/views/reservasi/index.blade.php, resources/views/reservasi/show.blade.php, and resources/views/reservasi/pdf.blade.php. Equivalent programmatic reservation operations are exposed at the API boundary by app/Http/Controllers/Api/ReservasiApiController.php.
Runtime and Infrastructure
The application runs on PHP/Laravel, installed and operated through composer.json and artisan; its web runtime requires a PHP server directed at public/. Persistence, cache, sessions, queueing, mail, file storage, and logging are configurable Laravel infrastructure boundaries in config/database.php, config/cache.php, config/session.php, config/queue.php, config/mail.php, config/filesystems.php, and config/logging.php.
Frontend assets are built with the Node/Vite pipeline defined by package.json and vite.config.js; source assets begin at resources/js/app.js and resources/css/app.css. Environment-specific credentials and service endpoints are supplied outside source control through .env (template: .env.example).
Main entry points: app.php Laravel bootstrap · web.php Web routes · ReservasiController.php Field & reservation controllers · Reservasi.php Eloquent domain models
Components 20
HTTP surfaces
- PHP web entry
public/index.php - Laravel bootstrap
bootstrap/app.php - Web routes
routes/web.php - API routes
routes/api.php - Auth routes
routes/auth.php
Application
- Field & reservation controllers · Handles browser CRUD and reservation workflows.
app/Http/Controllers/ReservasiController.php - Profile controller
app/Http/Controllers/ProfileController.php - Session auth controllers
app/Http/Controllers/Auth/AuthenticatedSessionController.php - API controllers · Exposes authentication, fields, and reservations programmatically.
app/Http/Controllers/Api/ReservasiApiController.php - Role enforcement
app/Http/Middleware/RoleMiddleware.php - Request validation · Validates field, profile, and login inputs.
app/Http/Requests/StoreLapanganRequest.php - Blade browser & PDF views · Renders dashboard, field, reservation, detail, and PDF pages.
resources/views/reservasi/show.blade.php - Field JSON resource
app/Http/Resources/LapanganResource.php
Domain & persistence
- Eloquent domain models · Users, sports fields, and reservations.
app/Models/Reservasi.php - Schema migrations · Creates users, roles, tokens, fields, and reservations.
database/migrations/2026_07_16_070102_create_reservasis_table.php - Application database
config/database.php
Runtime & infrastructure
- Sanctum token auth
config/sanctum.php - Laravel infrastructure · Configures cache, sessions, queues, mail, storage, and logging.
config/session.php - Vite asset pipeline · Builds JavaScript and CSS assets for browser pages.
vite.config.js - PHP runtime tooling
composer.json
Connections 24
- PHP web entry → Laravel bootstrap: boots
- Laravel bootstrap → Web routes: dispatches browser routes
- Laravel bootstrap → API routes: dispatches API routes
- Laravel bootstrap → Auth routes: loads auth routes
- Web routes → Field & reservation controllers: maps CRUD flows
- Web routes → Profile controller: maps profile flows
- Web routes → Role enforcement: protects by role
- Auth routes → Session auth controllers: maps session auth
- API routes → API controllers: maps JSON endpoints
- API routes → Sanctum token auth: authenticates tokens
- Field & reservation controllers → Request validation: validates writes
- Profile controller → Request validation: validates profile input
- Session auth controllers → Request validation: validates login
- Field & reservation controllers → Eloquent domain models: manages fields and reservations
- API controllers → Eloquent domain models: operates on domain records
- API controllers → Field JSON resource: shapes field JSON
- Field & reservation controllers → Blade browser & PDF views: renders pages and PDF view
- Profile controller → Blade browser & PDF views: renders account pages
- Eloquent domain models → Application database: persists records
- Schema migrations → Application database: defines schema
- Sanctum token auth → Eloquent domain models: uses user token records
- Laravel bootstrap → Laravel infrastructure: configures runtime services
- Blade browser & PDF views → Vite asset pipeline: uses built assets
- PHP runtime tooling → Laravel bootstrap: installs and operates app