# hutagalung12/uasyuda architecture

> Architecture diagram of the GitHub repository hutagalung12/uasyuda, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-07-19). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/hutagalung12/uasyuda
- Repository: https://github.com/hutagalung12/uasyuda

## Overview

#### Purpose and Entry Points
This is a Laravel application for managing sports-field (“lapangan”) inventory and reservations, including payment-proof upload and reservation reporting. HTTP traffic enters through `public/index.php`, is bootstrapped by `bootstrap/app.php`, and is split into browser routes in `routes/web.php` and token-oriented API routes in `routes/api.php`.

#### HTTP Delivery Surfaces
The server-rendered application uses controllers and Blade views for authentication, field administration, reservations, and reports:
- `app/Http/Controllers/AuthController.php`
- `app/Http/Controllers/LapanganController.php`
- `app/Http/Controllers/ReservasiController.php`
- `resources/views/lapangans/index.blade.php`
- `resources/views/reservasis/index.blade.php`

A parallel API surface exposes authentication and field operations through:
- `app/Http/Controllers/Api/AuthController.php`
- `app/Http/Controllers/Api/LapanganController.php`
- `routes/api.php`

#### Identity and Authorization Boundary
Users are persisted through the application user model and schema, with Laravel authentication configuration and Sanctum available for API token authentication:
- `app/Models/User.php`
- `config/auth.php`
- `config/sanctum.php`
- `database/migrations/2026_07_16_074008_create_personal_access_tokens_table.php`

Role-based access is an explicit middleware boundary in `app/Http/Middleware/CheckRole.php`. Route middleware determines which actors may administer fields, create/manage reservations, or access reports.

#### Core Reservation Domain
The principal domain entities are fields and reservations:
- `app/Models/Lapangan.php`
- `app/Models/Reservasi.php`
- `database/migrations/2026_07_16_074117_create_lapangans_table.php`
- `database/migrations/2026_07_16_074117_create_reservasis_table.php`

The expected flow is: a user selects a field, submits reservation data, the controller persists a `Reservasi` linked to the selected `Lapangan`, and staff or users can inspect reservation listings. Request validation forms establish the input boundary before controller/domain persistence:
- `app/Http/Requests/StoreReservasiRequest.php`
- `app/Http/Requests/StoreLapanganRequest.php`
- `app/Http/Requests/UpdateLapanganRequest.php`

#### Payment Proof and File Storage
Reservation payment evidence is handled as a separate upload step, rather than embedded only in reservation creation:
- `app/Http/Requests/UploadBuktiRequest.php`
- `resources/views/reservasis/upload-bukti.blade.php`
- `app/Http/Controllers/ReservasiController.php`

Uploaded files cross into Laravel’s configured filesystem abstraction (`config/filesystems.php`) and application storage (`storage/app/public` or `storage/app/private`). This is a material boundary for validation, access control, URL exposure, and retention of payment documents.

#### Presentation, API Serialization, and Reporting
Browser responses are rendered from Blade templates under `resources/views`, while API field responses are normalized by:
- `app/Http/Resources/LapanganResource.php`
- `resources/views/layouts/app.blade.php`

Reporting is owned by a dedicated controller and a reservation PDF-oriented view:
- `app/Http/Controllers/LaporanController.php`
- `resources/views/laporan/reservasi-pdf.blade.php`

This separates operational CRUD pages from a report-generation path that likely transforms reservation data into a printable/downloadable document.

#### Runtime and Infrastructure
The runtime is PHP/Laravel with Composer dependencies (`composer.json`), Eloquent-backed database configuration (`config/database.php`), and standard Laravel cache, session, queue, mail, and logging integration:
- `config/cache.php`
- `config/session.php`
- `config/queue.php`
- `config/logging.php`

The repository also includes a Vite-managed frontend asset entry (`resources/js/app.js`, `vite.config.js`). Database migrations define users, fields, reservations, personal tokens, cache, and jobs, enabling either relational database-backed operational state and optional queued work.

Main entry points: [`routes/web.php`](https://github.com/hutagalung12/uasyuda/blob/main/routes/web.php) (Browser routes), [`app/Http/Controllers/ReservasiController.php`](https://github.com/hutagalung12/uasyuda/blob/main/app/Http/Controllers/ReservasiController.php) (Reservation controller), [`app/Models/Reservasi.php`](https://github.com/hutagalung12/uasyuda/blob/main/app/Models/Reservasi.php) (Reservation), [`app/Models/Lapangan.php`](https://github.com/hutagalung12/uasyuda/blob/main/app/Models/Lapangan.php) (Sports field)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Laravel Runtime"]
  node_entry{{"HTTP entry<br/>Laravel entrypoint<br/>[index.php]"}}
  node_bootstrap["Application bootstrap<br/>Laravel bootstrap<br/>[app.php]"]
end

subgraph group_http["HTTP Surfaces"]
  node_browser(("Browser users<br/>client"))
  node_api_clients(("API clients"))
  node_web_routes["Browser routes<br/>route definitions<br/>[web.php]"]
  node_api_routes["API routes<br/>route definitions<br/>[api.php]"]
  node_auth_roles["Auth and role gate<br/>middleware/auth<br/>[CheckRole.php]"]
end

subgraph group_domain["Reservation Domain"]
  node_web_controllers["Reservation controller<br/>web controller"]
  node_field_controller["Field administration<br/>web controller"]
  node_api_controllers["Field API<br/>API controller"]
  node_request_validation["Reservation input validation<br/>form request"]
  node_reservation_model["Reservation<br/>Eloquent model<br/>[Reservasi.php]"]
  node_field_model["Sports field<br/>Eloquent model<br/>[Lapangan.php]"]
  node_user_identity["User identity<br/>Eloquent model<br/>[User.php]"]
end

subgraph group_delivery["Delivery &amp; Reporting"]
  node_blade_views["Blade pages<br/>server-rendered views<br/>[index.blade.php]"]
  node_api_resource["Field API serializer<br/>JSON resource"]
  node_reporting["Reservation reporting<br/>report controller"]
  node_pdf_view["Reservation PDF view<br/>report template"]
end

subgraph group_infra["State &amp; Storage"]
  node_database[("Relational database<br/>Eloquent database<br/>[database.php]")]
  node_file_storage[("Payment document storage<br/>Laravel filesystem<br/>[filesystems.php]")]
end

node_browser -->|"HTTP requests"| node_entry
node_api_clients -->|"API requests"| node_entry
node_entry -->|"boots"| node_bootstrap
node_bootstrap -->|"registers"| node_web_routes
node_bootstrap -->|"registers"| node_api_routes
node_web_routes -->|"applies auth/roles"| node_auth_roles
node_api_routes -->|"token auth and roles"| node_auth_roles
node_auth_roles -->|"resolves user"| node_user_identity
node_user_identity -->|"persists"| node_database
node_web_routes -->|"dispatches"| node_web_controllers
node_web_routes -->|"dispatches"| node_field_controller
node_api_routes -->|"dispatches"| node_api_controllers
node_web_controllers -->|"validates input"| node_request_validation
node_request_validation -->|"accepted booking data"| node_reservation_model
node_web_controllers -->|"creates and lists"| node_reservation_model
node_web_controllers -->|"stores payment proof"| node_file_storage
node_reservation_model -->|"belongs to"| node_field_model
node_reservation_model -->|"persists"| node_database
node_field_model -->|"persists"| node_database
node_web_controllers -->|"renders"| node_blade_views
node_field_controller -->|"manages"| node_field_model
node_api_controllers -->|"queries and manages"| node_field_model
node_api_controllers -->|"serializes"| node_api_resource
node_web_routes -->|"dispatches reports"| node_reporting
node_reporting -->|"reads reservations"| node_reservation_model
node_reporting -->|"renders"| node_pdf_view

click node_entry "https://github.com/hutagalung12/uasyuda/blob/main/public/index.php"
click node_bootstrap "https://github.com/hutagalung12/uasyuda/blob/main/bootstrap/app.php"
click node_web_routes "https://github.com/hutagalung12/uasyuda/blob/main/routes/web.php"
click node_api_routes "https://github.com/hutagalung12/uasyuda/blob/main/routes/api.php"
click node_auth_roles "https://github.com/hutagalung12/uasyuda/blob/main/app/Http/Middleware/CheckRole.php"
click node_web_controllers "https://github.com/hutagalung12/uasyuda/blob/main/app/Http/Controllers/ReservasiController.php"
click node_field_controller "https://github.com/hutagalung12/uasyuda/blob/main/app/Http/Controllers/LapanganController.php"
click node_api_controllers "https://github.com/hutagalung12/uasyuda/blob/main/app/Http/Controllers/Api/LapanganController.php"
click node_request_validation "https://github.com/hutagalung12/uasyuda/blob/main/app/Http/Requests/StoreReservasiRequest.php"
click node_reservation_model "https://github.com/hutagalung12/uasyuda/blob/main/app/Models/Reservasi.php"
click node_field_model "https://github.com/hutagalung12/uasyuda/blob/main/app/Models/Lapangan.php"
click node_user_identity "https://github.com/hutagalung12/uasyuda/blob/main/app/Models/User.php"
click node_blade_views "https://github.com/hutagalung12/uasyuda/blob/main/resources/views/reservasis/index.blade.php"
click node_api_resource "https://github.com/hutagalung12/uasyuda/blob/main/app/Http/Resources/LapanganResource.php"
click node_reporting "https://github.com/hutagalung12/uasyuda/blob/main/app/Http/Controllers/LaporanController.php"
click node_pdf_view "https://github.com/hutagalung12/uasyuda/blob/main/resources/views/laporan/reservasi-pdf.blade.php"
click node_database "https://github.com/hutagalung12/uasyuda/blob/main/config/database.php"
click node_file_storage "https://github.com/hutagalung12/uasyuda/blob/main/config/filesystems.php"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_entry,node_bootstrap toneBlue
class node_browser,node_api_clients,node_web_routes,node_api_routes,node_auth_roles toneAmber
class node_web_controllers,node_field_controller,node_api_controllers,node_request_validation,node_reservation_model,node_field_model,node_user_identity toneMint
class node_blade_views,node_api_resource,node_reporting,node_pdf_view toneRose
class node_database,node_file_storage toneIndigo
```

## Components

### Laravel Runtime

- [HTTP entry](https://github.com/hutagalung12/uasyuda/blob/main/public/index.php): Laravel entrypoint · `public/index.php`
- [Application bootstrap](https://github.com/hutagalung12/uasyuda/blob/main/bootstrap/app.php): Laravel bootstrap · `bootstrap/app.php`

### HTTP Surfaces

- **Browser users**: client
- **API clients**: client · Token-oriented consumers.
- [Browser routes](https://github.com/hutagalung12/uasyuda/blob/main/routes/web.php): route definitions · `routes/web.php`
- [API routes](https://github.com/hutagalung12/uasyuda/blob/main/routes/api.php): route definitions · `routes/api.php`
- [Auth and role gate](https://github.com/hutagalung12/uasyuda/blob/main/app/Http/Middleware/CheckRole.php): middleware/auth · Authenticates users and restricts route actions by role. · `app/Http/Middleware/CheckRole.php`

### Reservation Domain

- [Reservation controller](https://github.com/hutagalung12/uasyuda/blob/main/app/Http/Controllers/ReservasiController.php): web controller · Creates, lists, and accepts payment proof for reservations. · `app/Http/Controllers/ReservasiController.php`
- [Field administration](https://github.com/hutagalung12/uasyuda/blob/main/app/Http/Controllers/LapanganController.php): web controller · `app/Http/Controllers/LapanganController.php`
- [Field API](https://github.com/hutagalung12/uasyuda/blob/main/app/Http/Controllers/Api/LapanganController.php): API controller · Serves token-authenticated field operations. · `app/Http/Controllers/Api/LapanganController.php`
- [Reservation input validation](https://github.com/hutagalung12/uasyuda/blob/main/app/Http/Requests/StoreReservasiRequest.php): form request · Validates reservation creation and proof uploads. · `app/Http/Requests/StoreReservasiRequest.php`
- [Reservation](https://github.com/hutagalung12/uasyuda/blob/main/app/Models/Reservasi.php): Eloquent model · Links a booking to its selected field and payment evidence. · `app/Models/Reservasi.php`
- [Sports field](https://github.com/hutagalung12/uasyuda/blob/main/app/Models/Lapangan.php): Eloquent model · `app/Models/Lapangan.php`
- [User identity](https://github.com/hutagalung12/uasyuda/blob/main/app/Models/User.php): Eloquent model · Authenticated users and API token owners. · `app/Models/User.php`

### Delivery & Reporting

- [Blade pages](https://github.com/hutagalung12/uasyuda/blob/main/resources/views/reservasis/index.blade.php): server-rendered views · Operational field and reservation pages. · `resources/views/reservasis/index.blade.php`
- [Field API serializer](https://github.com/hutagalung12/uasyuda/blob/main/app/Http/Resources/LapanganResource.php): JSON resource · `app/Http/Resources/LapanganResource.php`
- [Reservation reporting](https://github.com/hutagalung12/uasyuda/blob/main/app/Http/Controllers/LaporanController.php): report controller · Builds printable reservation reports. · `app/Http/Controllers/LaporanController.php`
- [Reservation PDF view](https://github.com/hutagalung12/uasyuda/blob/main/resources/views/laporan/reservasi-pdf.blade.php): report template · `resources/views/laporan/reservasi-pdf.blade.php`

### State & Storage

- [Relational database](https://github.com/hutagalung12/uasyuda/blob/main/config/database.php): Eloquent database · Persists users, fields, reservations, and personal access tokens. · `config/database.php`
- [Payment document storage](https://github.com/hutagalung12/uasyuda/blob/main/config/filesystems.php): Laravel filesystem · Stores uploaded payment proof in configured application disks. · `config/filesystems.php`

## Connections

- Browser users → HTTP entry: HTTP requests
- API clients → HTTP entry: API requests
- HTTP entry → Application bootstrap: boots
- Application bootstrap → Browser routes: registers
- Application bootstrap → API routes: registers
- Browser routes → Auth and role gate: applies auth/roles
- API routes → Auth and role gate: token auth and roles
- Auth and role gate → User identity: resolves user
- User identity → Relational database: persists
- Browser routes → Reservation controller: dispatches
- Browser routes → Field administration: dispatches
- API routes → Field API: dispatches
- Reservation controller → Reservation input validation: validates input
- Reservation input validation → Reservation: accepted booking data
- Reservation controller → Reservation: creates and lists
- Reservation controller → Payment document storage: stores payment proof
- Reservation → Sports field: belongs to
- Reservation → Relational database: persists
- Sports field → Relational database: persists
- Reservation controller → Blade pages: renders
- Field administration → Sports field: manages
- Field API → Sports field: queries and manages
- Field API → Field API serializer: serializes
- Browser routes → Reservation reporting: dispatches reports
- Reservation reporting → Reservation: reads reservations
- Reservation reporting → Reservation PDF view: renders
