# debora1908/uas4sia_sirega architecture

> Architecture diagram of the GitHub repository debora1908/uas4sia_sirega, 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/debora1908/uas4sia_sirega
- Repository: https://github.com/debora1908/uas4sia_sirega

## Overview

#### 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: [`bootstrap/app.php`](https://github.com/debora1908/uas4sia_sirega/blob/main/bootstrap/app.php) (Laravel bootstrap), [`routes/web.php`](https://github.com/debora1908/uas4sia_sirega/blob/main/routes/web.php) (Web routes), [`app/Http/Controllers/ReservasiController.php`](https://github.com/debora1908/uas4sia_sirega/blob/main/app/Http/Controllers/ReservasiController.php) (Field & reservation controllers), [`app/Models/Reservasi.php`](https://github.com/debora1908/uas4sia_sirega/blob/main/app/Models/Reservasi.php) (Eloquent domain models)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_http["HTTP surfaces"]
  node_public_entry(("PHP web entry<br/>entry point<br/>[index.php]"))
  node_laravel_bootstrap{{"Laravel bootstrap<br/>application bootstrap<br/>[app.php]"}}
  node_web_routes["Web routes<br/>browser routing<br/>[web.php]"]
  node_api_routes["API routes<br/>JSON routing<br/>[api.php]"]
  node_auth_routes["Auth routes<br/>session auth routing<br/>[auth.php]"]
end

subgraph group_application["Application"]
  node_web_controllers["Field &amp; reservation controllers<br/>web controllers"]
  node_profile_controller["Profile controller<br/>account controller"]
  node_auth_controllers["Session auth controllers<br/>authentication controllers"]
  node_api_controllers["API controllers<br/>JSON controllers"]
  node_role_middleware{{"Role enforcement<br/>authorization middleware<br/>[RoleMiddleware.php]"}}
  node_request_validation["Request validation<br/>form requests"]
  node_blade_views["Blade browser &amp; PDF views<br/>server-rendered views<br/>[show.blade.php]"]
  node_lapangan_resource["Field JSON resource<br/>API representation"]
end

subgraph group_domain["Domain &amp; persistence"]
  node_eloquent_models["Eloquent domain models<br/>[Reservasi.php]"]
  node_migrations["Schema migrations<br/>database schema"]
  node_database[("Application database<br/>transactional persistence<br/>[database.php]")]
end

subgraph group_runtime["Runtime &amp; infrastructure"]
  node_sanctum{{"Sanctum token auth<br/>API authentication<br/>[sanctum.php]"}}
  node_laravel_infrastructure["Laravel infrastructure<br/>runtime services<br/>[session.php]"]
  node_vite_assets["Vite asset pipeline<br/>frontend build<br/>[vite.config.js]"]
  node_composer_artisan["PHP runtime tooling<br/>Laravel operations<br/>[composer.json]"]
end

node_public_entry -->|"boots"| node_laravel_bootstrap
node_laravel_bootstrap -->|"dispatches browser routes"| node_web_routes
node_laravel_bootstrap -->|"dispatches API routes"| node_api_routes
node_laravel_bootstrap -->|"loads auth routes"| node_auth_routes
node_web_routes -->|"maps CRUD flows"| node_web_controllers
node_web_routes -->|"maps profile flows"| node_profile_controller
node_web_routes -->|"protects by role"| node_role_middleware
node_auth_routes -->|"maps session auth"| node_auth_controllers
node_api_routes -->|"maps JSON endpoints"| node_api_controllers
node_api_routes -->|"authenticates tokens"| node_sanctum
node_web_controllers -->|"validates writes"| node_request_validation
node_profile_controller -->|"validates profile input"| node_request_validation
node_auth_controllers -->|"validates login"| node_request_validation
node_web_controllers -->|"manages fields and reservations"| node_eloquent_models
node_api_controllers -->|"operates on domain records"| node_eloquent_models
node_api_controllers -->|"shapes field JSON"| node_lapangan_resource
node_web_controllers -->|"renders pages and PDF view"| node_blade_views
node_profile_controller -->|"renders account pages"| node_blade_views
node_eloquent_models -->|"persists records"| node_database
node_migrations -->|"defines schema"| node_database
node_sanctum -->|"uses user token records"| node_eloquent_models
node_laravel_bootstrap -->|"configures runtime services"| node_laravel_infrastructure
node_blade_views -.->|"uses built assets"| node_vite_assets
node_composer_artisan -.->|"installs and operates app"| node_laravel_bootstrap

click node_public_entry "https://github.com/debora1908/uas4sia_sirega/blob/main/public/index.php"
click node_laravel_bootstrap "https://github.com/debora1908/uas4sia_sirega/blob/main/bootstrap/app.php"
click node_web_routes "https://github.com/debora1908/uas4sia_sirega/blob/main/routes/web.php"
click node_api_routes "https://github.com/debora1908/uas4sia_sirega/blob/main/routes/api.php"
click node_auth_routes "https://github.com/debora1908/uas4sia_sirega/blob/main/routes/auth.php"
click node_web_controllers "https://github.com/debora1908/uas4sia_sirega/blob/main/app/Http/Controllers/ReservasiController.php"
click node_profile_controller "https://github.com/debora1908/uas4sia_sirega/blob/main/app/Http/Controllers/ProfileController.php"
click node_auth_controllers "https://github.com/debora1908/uas4sia_sirega/blob/main/app/Http/Controllers/Auth/AuthenticatedSessionController.php"
click node_api_controllers "https://github.com/debora1908/uas4sia_sirega/blob/main/app/Http/Controllers/Api/ReservasiApiController.php"
click node_role_middleware "https://github.com/debora1908/uas4sia_sirega/blob/main/app/Http/Middleware/RoleMiddleware.php"
click node_request_validation "https://github.com/debora1908/uas4sia_sirega/blob/main/app/Http/Requests/StoreLapanganRequest.php"
click node_blade_views "https://github.com/debora1908/uas4sia_sirega/blob/main/resources/views/reservasi/show.blade.php"
click node_lapangan_resource "https://github.com/debora1908/uas4sia_sirega/blob/main/app/Http/Resources/LapanganResource.php"
click node_eloquent_models "https://github.com/debora1908/uas4sia_sirega/blob/main/app/Models/Reservasi.php"
click node_migrations "https://github.com/debora1908/uas4sia_sirega/blob/main/database/migrations/2026_07_16_070102_create_reservasis_table.php"
click node_database "https://github.com/debora1908/uas4sia_sirega/blob/main/config/database.php"
click node_sanctum "https://github.com/debora1908/uas4sia_sirega/blob/main/config/sanctum.php"
click node_laravel_infrastructure "https://github.com/debora1908/uas4sia_sirega/blob/main/config/session.php"
click node_vite_assets "https://github.com/debora1908/uas4sia_sirega/blob/main/vite.config.js"
click node_composer_artisan "https://github.com/debora1908/uas4sia_sirega/blob/main/composer.json"

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_public_entry,node_laravel_bootstrap,node_web_routes,node_api_routes,node_auth_routes toneBlue
class node_web_controllers,node_profile_controller,node_auth_controllers,node_api_controllers,node_role_middleware,node_request_validation,node_blade_views,node_lapangan_resource toneAmber
class node_eloquent_models,node_migrations,node_database toneMint
class node_sanctum,node_laravel_infrastructure,node_vite_assets,node_composer_artisan toneRose
```

## Components

### HTTP surfaces

- [PHP web entry](https://github.com/debora1908/uas4sia_sirega/blob/main/public/index.php): entry point · `public/index.php`
- [Laravel bootstrap](https://github.com/debora1908/uas4sia_sirega/blob/main/bootstrap/app.php): application bootstrap · `bootstrap/app.php`
- [Web routes](https://github.com/debora1908/uas4sia_sirega/blob/main/routes/web.php): browser routing · `routes/web.php`
- [API routes](https://github.com/debora1908/uas4sia_sirega/blob/main/routes/api.php): JSON routing · `routes/api.php`
- [Auth routes](https://github.com/debora1908/uas4sia_sirega/blob/main/routes/auth.php): session auth routing · `routes/auth.php`

### Application

- [Field & reservation controllers](https://github.com/debora1908/uas4sia_sirega/blob/main/app/Http/Controllers/ReservasiController.php): web controllers · Handles browser CRUD and reservation workflows. · `app/Http/Controllers/ReservasiController.php`
- [Profile controller](https://github.com/debora1908/uas4sia_sirega/blob/main/app/Http/Controllers/ProfileController.php): account controller · `app/Http/Controllers/ProfileController.php`
- [Session auth controllers](https://github.com/debora1908/uas4sia_sirega/blob/main/app/Http/Controllers/Auth/AuthenticatedSessionController.php): authentication controllers · `app/Http/Controllers/Auth/AuthenticatedSessionController.php`
- [API controllers](https://github.com/debora1908/uas4sia_sirega/blob/main/app/Http/Controllers/Api/ReservasiApiController.php): JSON controllers · Exposes authentication, fields, and reservations programmatically. · `app/Http/Controllers/Api/ReservasiApiController.php`
- [Role enforcement](https://github.com/debora1908/uas4sia_sirega/blob/main/app/Http/Middleware/RoleMiddleware.php): authorization middleware · `app/Http/Middleware/RoleMiddleware.php`
- [Request validation](https://github.com/debora1908/uas4sia_sirega/blob/main/app/Http/Requests/StoreLapanganRequest.php): form requests · Validates field, profile, and login inputs. · `app/Http/Requests/StoreLapanganRequest.php`
- [Blade browser & PDF views](https://github.com/debora1908/uas4sia_sirega/blob/main/resources/views/reservasi/show.blade.php): server-rendered views · Renders dashboard, field, reservation, detail, and PDF pages. · `resources/views/reservasi/show.blade.php`
- [Field JSON resource](https://github.com/debora1908/uas4sia_sirega/blob/main/app/Http/Resources/LapanganResource.php): API representation · `app/Http/Resources/LapanganResource.php`

### Domain & persistence

- [Eloquent domain models](https://github.com/debora1908/uas4sia_sirega/blob/main/app/Models/Reservasi.php): domain models · Users, sports fields, and reservations. · `app/Models/Reservasi.php`
- [Schema migrations](https://github.com/debora1908/uas4sia_sirega/blob/main/database/migrations/2026_07_16_070102_create_reservasis_table.php): database schema · Creates users, roles, tokens, fields, and reservations. · `database/migrations/2026_07_16_070102_create_reservasis_table.php`
- [Application database](https://github.com/debora1908/uas4sia_sirega/blob/main/config/database.php): transactional persistence · `config/database.php`

### Runtime & infrastructure

- [Sanctum token auth](https://github.com/debora1908/uas4sia_sirega/blob/main/config/sanctum.php): API authentication · `config/sanctum.php`
- [Laravel infrastructure](https://github.com/debora1908/uas4sia_sirega/blob/main/config/session.php): runtime services · Configures cache, sessions, queues, mail, storage, and logging. · `config/session.php`
- [Vite asset pipeline](https://github.com/debora1908/uas4sia_sirega/blob/main/vite.config.js): frontend build · Builds JavaScript and CSS assets for browser pages. · `vite.config.js`
- [PHP runtime tooling](https://github.com/debora1908/uas4sia_sirega/blob/main/composer.json): Laravel operations · `composer.json`

## Connections

- 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
