# charls2004/i-monitor architecture

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

- Interactive diagram: https://gitdiagram.com/charls2004/i-monitor
- Repository: https://github.com/charls2004/i-monitor

## Overview

i-Monitor is a role-based fleet and operations application. Its main workflow is staff recording vehicle and defect information, routing requests for review, and maintaining related records; fuel withdrawal and consumption reporting form a distinct operational branch. Vehicle documents, OCR, agreements, notifications, and exports are supporting capabilities visible in the source index and tree. The sampled excerpts do not expose route wiring or several controller implementations, so relationships are limited to documented model references and shown service/controller interactions.

Main entry points: [`app/Models/Vehicle.php`](https://github.com/charls2004/i-monitor/blob/main/app/Models/Vehicle.php) (Vehicle registry), [`app/Http/Controllers/DefectReportController.php`](https://github.com/charls2004/i-monitor/blob/main/app/Http/Controllers/DefectReportController.php) (Defect workflow), [`app/Models/User.php`](https://github.com/charls2004/i-monitor/blob/main/app/Models/User.php) (Users and roles), [`app/Http/Controllers/WithdrawalSlipController.php`](https://github.com/charls2004/i-monitor/blob/main/app/Http/Controllers/WithdrawalSlipController.php) (Fuel operations)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_fleet["Fleet records"]
  node_user["Users and roles<br/>[User.php]"]
  node_vehicle["Vehicle registry<br/>[Vehicle.php]"]
  node_department["Departments<br/>[Department.php]"]
  node_assignment["Driver assignments"]
  node_registration["Registrations<br/>[Registration.php]"]
  node_insurance["Insurance records<br/>[Insurance.php]"]
  node_documents["Vehicle documents<br/>[Document.php]"]
end

subgraph group_operations["Operational workflows"]
  node_defect["Defect requests<br/>[DefectReport.php]"]
  node_defectflow["Defect workflow"]
  node_maintenance["Maintenance records<br/>[Maintenance.php]"]
end

subgraph group_fuel["Fuel management"]
  node_fuelcontroller["Fuel operations"]
  node_withdrawal["Withdrawal slips"]
  node_fuelrecord["Fuel records<br/>[FuelRecord.php]"]
  node_fuelreport["Consumption reports"]
end

subgraph group_support["Shared services"]
  node_notification["Notifications<br/>[Notification.php]"]
  node_editednotify["Edited-request alerts"]
  node_agreement["Agreement service"]
  node_ocr["Registration OCR"]
  node_export["Job-order export"]
end

node_operator(("Application users"))

node_defectflow -->|"manages requests"| node_defect
node_defectflow -->|"loads vehicles"| node_vehicle
node_defectflow -->|"notifies staff"| node_user
node_defectflow -->|"creates alerts"| node_notification
node_defectflow -->|"exports reports"| node_export
node_fuelcontroller -->|"manages slips"| node_withdrawal
node_fuelcontroller -->|"resolves drivers"| node_user
node_fuelcontroller -->|"loads vehicles"| node_vehicle
node_editednotify -->|"creates alerts"| node_notification
node_agreement -->|"checks agreements"| node_user
node_agreement -.->|"records acknowledgement"| node_operator
node_vehicle -->|"has registration"| node_registration
node_vehicle -->|"has insurance"| node_insurance
node_vehicle -->|"has maintenance"| node_maintenance
node_vehicle -->|"has documents"| node_documents
node_user -->|"has assignments"| node_assignment
node_user -->|"belongs to department"| node_department
node_maintenance -->|"may originate from"| node_defect
node_fuelreport -->|"reports by vehicle"| node_vehicle
node_ocr -->|"parses registration"| node_registration
node_operator -.->|"files requests"| node_defectflow
node_operator -.->|"handles fuel requests"| node_fuelcontroller

click node_user "https://github.com/charls2004/i-monitor/blob/main/app/Models/User.php"
click node_vehicle "https://github.com/charls2004/i-monitor/blob/main/app/Models/Vehicle.php"
click node_department "https://github.com/charls2004/i-monitor/blob/main/app/Models/Department.php"
click node_assignment "https://github.com/charls2004/i-monitor/blob/main/app/Models/DriverVehicleAssignment.php"
click node_registration "https://github.com/charls2004/i-monitor/blob/main/app/Models/Registration.php"
click node_insurance "https://github.com/charls2004/i-monitor/blob/main/app/Models/Insurance.php"
click node_documents "https://github.com/charls2004/i-monitor/blob/main/app/Models/Document.php"
click node_defect "https://github.com/charls2004/i-monitor/blob/main/app/Models/DefectReport.php"
click node_defectflow "https://github.com/charls2004/i-monitor/blob/main/app/Http/Controllers/DefectReportController.php"
click node_maintenance "https://github.com/charls2004/i-monitor/blob/main/app/Models/Maintenance.php"
click node_fuelcontroller "https://github.com/charls2004/i-monitor/blob/main/app/Http/Controllers/WithdrawalSlipController.php"
click node_withdrawal "https://github.com/charls2004/i-monitor/blob/main/app/Models/FuelWithdrawalSlip.php"
click node_fuelrecord "https://github.com/charls2004/i-monitor/blob/main/app/Models/FuelRecord.php"
click node_fuelreport "https://github.com/charls2004/i-monitor/blob/main/app/Services/MonthlyFuelConsumptionReportService.php"
click node_notification "https://github.com/charls2004/i-monitor/blob/main/app/Models/Notification.php"
click node_editednotify "https://github.com/charls2004/i-monitor/blob/main/app/Services/RequestEditedNotificationService.php"
click node_agreement "https://github.com/charls2004/i-monitor/blob/main/app/Services/UserAgreementService.php"
click node_ocr "https://github.com/charls2004/i-monitor/blob/main/app/Services/Ocr/GeminiOcrService.php"
click node_export "https://github.com/charls2004/i-monitor/blob/main/app/Exports/JobOrderRequestExport.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_user,node_vehicle,node_department,node_assignment,node_registration,node_insurance,node_documents,node_operator toneBlue
class node_defect,node_defectflow,node_maintenance toneAmber
class node_fuelcontroller,node_withdrawal,node_fuelrecord,node_fuelreport toneMint
class node_notification,node_editednotify,node_agreement,node_ocr,node_export toneRose
```

## Components

### Fleet records

- [Users and roles](https://github.com/charls2004/i-monitor/blob/main/app/Models/User.php): `app/Models/User.php`
- [Vehicle registry](https://github.com/charls2004/i-monitor/blob/main/app/Models/Vehicle.php): `app/Models/Vehicle.php`
- [Departments](https://github.com/charls2004/i-monitor/blob/main/app/Models/Department.php): `app/Models/Department.php`
- [Driver assignments](https://github.com/charls2004/i-monitor/blob/main/app/Models/DriverVehicleAssignment.php): `app/Models/DriverVehicleAssignment.php`
- [Registrations](https://github.com/charls2004/i-monitor/blob/main/app/Models/Registration.php): `app/Models/Registration.php`
- [Insurance records](https://github.com/charls2004/i-monitor/blob/main/app/Models/Insurance.php): `app/Models/Insurance.php`
- [Vehicle documents](https://github.com/charls2004/i-monitor/blob/main/app/Models/Document.php): `app/Models/Document.php`

### Operational workflows

- [Defect requests](https://github.com/charls2004/i-monitor/blob/main/app/Models/DefectReport.php): `app/Models/DefectReport.php`
- [Defect workflow](https://github.com/charls2004/i-monitor/blob/main/app/Http/Controllers/DefectReportController.php): `app/Http/Controllers/DefectReportController.php`
- [Maintenance records](https://github.com/charls2004/i-monitor/blob/main/app/Models/Maintenance.php): `app/Models/Maintenance.php`

### Fuel management

- [Fuel operations](https://github.com/charls2004/i-monitor/blob/main/app/Http/Controllers/WithdrawalSlipController.php): `app/Http/Controllers/WithdrawalSlipController.php`
- [Withdrawal slips](https://github.com/charls2004/i-monitor/blob/main/app/Models/FuelWithdrawalSlip.php): `app/Models/FuelWithdrawalSlip.php`
- [Fuel records](https://github.com/charls2004/i-monitor/blob/main/app/Models/FuelRecord.php): `app/Models/FuelRecord.php`
- [Consumption reports](https://github.com/charls2004/i-monitor/blob/main/app/Services/MonthlyFuelConsumptionReportService.php): `app/Services/MonthlyFuelConsumptionReportService.php`

### Shared services

- [Notifications](https://github.com/charls2004/i-monitor/blob/main/app/Models/Notification.php): `app/Models/Notification.php`
- [Edited-request alerts](https://github.com/charls2004/i-monitor/blob/main/app/Services/RequestEditedNotificationService.php): `app/Services/RequestEditedNotificationService.php`
- [Agreement service](https://github.com/charls2004/i-monitor/blob/main/app/Services/UserAgreementService.php): `app/Services/UserAgreementService.php`
- [Registration OCR](https://github.com/charls2004/i-monitor/blob/main/app/Services/Ocr/GeminiOcrService.php): `app/Services/Ocr/GeminiOcrService.php`
- [Job-order export](https://github.com/charls2004/i-monitor/blob/main/app/Exports/JobOrderRequestExport.php): `app/Exports/JobOrderRequestExport.php`

### Other components

- **Application users**

## Connections

- Defect workflow → Defect requests: manages requests (evidence: `app/Http/Controllers/DefectReportController.php`)
- Defect workflow → Vehicle registry: loads vehicles (evidence: `app/Http/Controllers/DefectReportController.php`)
- Defect workflow → Users and roles: notifies staff (evidence: `app/Http/Controllers/DefectReportController.php`)
- Defect workflow → Notifications: creates alerts (evidence: `app/Http/Controllers/DefectReportController.php`)
- Defect workflow → Job-order export: exports reports (evidence: `app/Http/Controllers/DefectReportController.php`)
- Fuel operations → Withdrawal slips: manages slips (evidence: `app/Http/Controllers/WithdrawalSlipController.php`)
- Fuel operations → Users and roles: resolves drivers (evidence: `app/Http/Controllers/WithdrawalSlipController.php`)
- Fuel operations → Vehicle registry: loads vehicles (evidence: `app/Http/Controllers/WithdrawalSlipController.php`)
- Edited-request alerts → Notifications: creates alerts (evidence: `app/Services/RequestEditedNotificationService.php`)
- Agreement service → Users and roles: checks agreements (evidence: `app/Services/UserAgreementService.php`)
- Agreement service → Application users: records acknowledgement
- Vehicle registry → Registrations: has registration (evidence: `app/Models/Vehicle.php`)
- Vehicle registry → Insurance records: has insurance (evidence: `app/Models/Vehicle.php`)
- Vehicle registry → Maintenance records: has maintenance (evidence: `app/Models/Vehicle.php`)
- Vehicle registry → Vehicle documents: has documents (evidence: `app/Models/Vehicle.php`)
- Users and roles → Driver assignments: has assignments (evidence: `app/Models/User.php`)
- Users and roles → Departments: belongs to department (evidence: `app/Models/User.php`)
- Maintenance records → Defect requests: may originate from (evidence: `app/Models/Maintenance.php`)
- Consumption reports → Vehicle registry: reports by vehicle (evidence: `app/Services/MonthlyFuelConsumptionReportService.php`)
- Registration OCR → Registrations: parses registration (evidence: `app/Services/Ocr/GeminiOcrService.php`)
- Application users → Defect workflow: files requests
- Application users → Fuel operations: handles fuel requests
