# obaiddp/log-report-backend architecture

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

- Interactive diagram: https://gitdiagram.com/obaiddp/log-report-backend
- Repository: https://github.com/obaiddp/log-report-backend

## Overview

This is a Laravel JSON API for an IT support-log system. A frontend obtains a Sanctum CSRF cookie, logs in, then calls authenticated routes; controllers validate requests, apply permission gates where configured, and read or mutate support-log and directory data before returning JSON. Separate branches expose dashboard performance and user/role/permission administration. The source index and excerpts establish the main route, controller, and model relationships; database schema details and several resource/policy implementations were not shown.

Main entry points: [`routes/api.php`](https://github.com/obaiddp/log-report-backend/blob/main/routes/api.php) (API routes), [`app/Models/SupportLog.php`](https://github.com/obaiddp/log-report-backend/blob/main/app/Models/SupportLog.php) (Support-log records), [`app/Models/User.php`](https://github.com/obaiddp/log-report-backend/blob/main/app/Models/User.php) (User identity), [`app/Models/Role.php`](https://github.com/obaiddp/log-report-backend/blob/main/app/Models/Role.php) (Roles)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API and access"]
  node_api_routes["API routes<br/>[api.php]"]
  node_auth["Authentication<br/>[AuthController.php]"]
  node_permission_gate["Permission middleware"]
end

subgraph group_logs["Support logs"]
  node_support_controller["Support-log API"]
  node_support_model["Support-log records<br/>[SupportLog.php]"]
  node_assignment_model["Log assignments"]
  node_support_resource["Log response resource"]
end

subgraph group_directory["Directory data"]
  node_department_controller["Department API"]
  node_department_model["Departments<br/>[Department.php]"]
  node_item_controller["Item-type API<br/>[ItemController.php]"]
  node_item_model["Item types<br/>[ItemType.php]"]
  node_issue_controller["Issue-type API"]
  node_issue_model["Issue types<br/>[IssueType.php]"]
end

subgraph group_access["Identity and RBAC"]
  node_user_controller["User administration<br/>[UserController.php]"]
  node_user_model["User identity<br/>[User.php]"]
  node_role_controller["Role API<br/>[RoleController.php]"]
  node_role_permission_controller["Role permissions"]
  node_permission_controller["Permission API"]
  node_role_model["Roles<br/>[Role.php]"]
  node_permission_model["Permissions<br/>[Permission.php]"]
end

subgraph group_reporting["Reporting"]
  node_dashboard["Performance dashboard"]
end

node_frontend(("React frontend"))
node_database[("Application database")]

node_frontend -->|"sends API requests"| node_api_routes
node_api_routes -->|"routes auth"| node_auth
node_api_routes -->|"routes logs"| node_support_controller
node_api_routes -->|"routes departments"| node_department_controller
node_api_routes -->|"routes items"| node_item_controller
node_api_routes -->|"routes issues"| node_issue_controller
node_api_routes -->|"routes users"| node_user_controller
node_api_routes -->|"routes roles"| node_role_controller
node_api_routes -->|"routes assignments"| node_role_permission_controller
node_api_routes -->|"routes permissions"| node_permission_controller
node_api_routes -->|"routes dashboard"| node_dashboard
node_api_routes -->|"applies permission gate"| node_permission_gate
node_auth -->|"authenticates users"| node_user_model
node_support_controller -->|"queries and updates"| node_support_model
node_support_controller -->|"persists log changes"| node_database
node_support_controller -.->|"returns log data"| node_support_resource
node_support_model -->|"references department"| node_department_model
node_support_model -->|"references item type"| node_item_model
node_support_model -->|"relates issue types"| node_issue_model
node_support_model -->|"references users"| node_user_model
node_support_model -->|"has assignments"| node_assignment_model
node_department_controller -->|"queries and updates"| node_department_model
node_department_controller -->|"persists changes"| node_database
node_item_controller -->|"queries and updates"| node_item_model
node_item_controller -->|"persists changes"| node_database
node_issue_controller -->|"queries and updates"| node_issue_model
node_user_controller -->|"queries and updates"| node_user_model
node_role_controller -->|"queries roles"| node_role_model
node_permission_controller -->|"manages permissions"| node_permission_model
node_permission_controller -->|"loads role relation"| node_role_model
node_role_permission_controller -->|"updates role grants"| node_role_model
node_role_permission_controller -->|"assigns permissions"| node_permission_model
node_role_model -->|"links permissions"| node_permission_model
node_user_model -->|"belongs to role"| node_role_model
node_dashboard -->|"aggregates log data"| node_support_model
node_dashboard -->|"summarizes users"| node_user_model

click node_api_routes "https://github.com/obaiddp/log-report-backend/blob/main/routes/api.php"
click node_auth "https://github.com/obaiddp/log-report-backend/blob/main/app/Http/Controllers/AuthController.php"
click node_permission_gate "https://github.com/obaiddp/log-report-backend/blob/main/app/Http/Middleware/CheckPermission.php"
click node_support_controller "https://github.com/obaiddp/log-report-backend/blob/main/app/Http/Controllers/SupportLogController.php"
click node_support_model "https://github.com/obaiddp/log-report-backend/blob/main/app/Models/SupportLog.php"
click node_assignment_model "https://github.com/obaiddp/log-report-backend/blob/main/app/Models/SupportLogAssignment.php"
click node_support_resource "https://github.com/obaiddp/log-report-backend/blob/main/app/Http/Resources/SupportLogResource.php"
click node_department_controller "https://github.com/obaiddp/log-report-backend/blob/main/app/Http/Controllers/DepartmentController.php"
click node_department_model "https://github.com/obaiddp/log-report-backend/blob/main/app/Models/Department.php"
click node_item_controller "https://github.com/obaiddp/log-report-backend/blob/main/app/Http/Controllers/ItemController.php"
click node_item_model "https://github.com/obaiddp/log-report-backend/blob/main/app/Models/ItemType.php"
click node_issue_controller "https://github.com/obaiddp/log-report-backend/blob/main/app/Http/Controllers/IssueController.php"
click node_issue_model "https://github.com/obaiddp/log-report-backend/blob/main/app/Models/IssueType.php"
click node_user_controller "https://github.com/obaiddp/log-report-backend/blob/main/app/Http/Controllers/UserController.php"
click node_user_model "https://github.com/obaiddp/log-report-backend/blob/main/app/Models/User.php"
click node_role_controller "https://github.com/obaiddp/log-report-backend/blob/main/app/Http/Controllers/RoleController.php"
click node_role_permission_controller "https://github.com/obaiddp/log-report-backend/blob/main/app/Http/Controllers/RolePermissionController.php"
click node_permission_controller "https://github.com/obaiddp/log-report-backend/blob/main/app/Http/Controllers/PermissionController.php"
click node_role_model "https://github.com/obaiddp/log-report-backend/blob/main/app/Models/Role.php"
click node_permission_model "https://github.com/obaiddp/log-report-backend/blob/main/app/Models/Permission.php"
click node_dashboard "https://github.com/obaiddp/log-report-backend/blob/main/app/Http/Controllers/DashboardController.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_api_routes,node_auth,node_permission_gate,node_frontend toneBlue
class node_support_controller,node_support_model,node_assignment_model,node_support_resource,node_database toneAmber
class node_department_controller,node_department_model,node_item_controller,node_item_model,node_issue_controller,node_issue_model toneMint
class node_user_controller,node_user_model,node_role_controller,node_role_permission_controller,node_permission_controller,node_role_model,node_permission_model toneRose
class node_dashboard toneIndigo
```

## Components

### API and access

- [API routes](https://github.com/obaiddp/log-report-backend/blob/main/routes/api.php): `routes/api.php`
- [Authentication](https://github.com/obaiddp/log-report-backend/blob/main/app/Http/Controllers/AuthController.php): `app/Http/Controllers/AuthController.php`
- [Permission middleware](https://github.com/obaiddp/log-report-backend/blob/main/app/Http/Middleware/CheckPermission.php): `app/Http/Middleware/CheckPermission.php`

### Support logs

- [Support-log API](https://github.com/obaiddp/log-report-backend/blob/main/app/Http/Controllers/SupportLogController.php): `app/Http/Controllers/SupportLogController.php`
- [Support-log records](https://github.com/obaiddp/log-report-backend/blob/main/app/Models/SupportLog.php): `app/Models/SupportLog.php`
- [Log assignments](https://github.com/obaiddp/log-report-backend/blob/main/app/Models/SupportLogAssignment.php): `app/Models/SupportLogAssignment.php`
- [Log response resource](https://github.com/obaiddp/log-report-backend/blob/main/app/Http/Resources/SupportLogResource.php): `app/Http/Resources/SupportLogResource.php`

### Directory data

- [Department API](https://github.com/obaiddp/log-report-backend/blob/main/app/Http/Controllers/DepartmentController.php): `app/Http/Controllers/DepartmentController.php`
- [Departments](https://github.com/obaiddp/log-report-backend/blob/main/app/Models/Department.php): `app/Models/Department.php`
- [Item-type API](https://github.com/obaiddp/log-report-backend/blob/main/app/Http/Controllers/ItemController.php): `app/Http/Controllers/ItemController.php`
- [Item types](https://github.com/obaiddp/log-report-backend/blob/main/app/Models/ItemType.php): `app/Models/ItemType.php`
- [Issue-type API](https://github.com/obaiddp/log-report-backend/blob/main/app/Http/Controllers/IssueController.php): `app/Http/Controllers/IssueController.php`
- [Issue types](https://github.com/obaiddp/log-report-backend/blob/main/app/Models/IssueType.php): `app/Models/IssueType.php`

### Identity and RBAC

- [User administration](https://github.com/obaiddp/log-report-backend/blob/main/app/Http/Controllers/UserController.php): `app/Http/Controllers/UserController.php`
- [User identity](https://github.com/obaiddp/log-report-backend/blob/main/app/Models/User.php): `app/Models/User.php`
- [Role API](https://github.com/obaiddp/log-report-backend/blob/main/app/Http/Controllers/RoleController.php): `app/Http/Controllers/RoleController.php`
- [Role permissions](https://github.com/obaiddp/log-report-backend/blob/main/app/Http/Controllers/RolePermissionController.php): `app/Http/Controllers/RolePermissionController.php`
- [Permission API](https://github.com/obaiddp/log-report-backend/blob/main/app/Http/Controllers/PermissionController.php): `app/Http/Controllers/PermissionController.php`
- [Roles](https://github.com/obaiddp/log-report-backend/blob/main/app/Models/Role.php): `app/Models/Role.php`
- [Permissions](https://github.com/obaiddp/log-report-backend/blob/main/app/Models/Permission.php): `app/Models/Permission.php`

### Reporting

- [Performance dashboard](https://github.com/obaiddp/log-report-backend/blob/main/app/Http/Controllers/DashboardController.php): `app/Http/Controllers/DashboardController.php`

### Other components

- **React frontend**
- **Application database**

## Connections

- React frontend → API routes: sends API requests (evidence: `README.md`)
- API routes → Authentication: routes auth (evidence: `routes/api.php`)
- API routes → Support-log API: routes logs (evidence: `routes/api.php`)
- API routes → Department API: routes departments (evidence: `routes/api.php`)
- API routes → Item-type API: routes items (evidence: `routes/api.php`)
- API routes → Issue-type API: routes issues (evidence: `routes/api.php`)
- API routes → User administration: routes users (evidence: `routes/api.php`)
- API routes → Role API: routes roles (evidence: `routes/api.php`)
- API routes → Role permissions: routes assignments (evidence: `routes/api.php`)
- API routes → Permission API: routes permissions (evidence: `routes/api.php`)
- API routes → Performance dashboard: routes dashboard (evidence: `routes/api.php`)
- API routes → Permission middleware: applies permission gate (evidence: `routes/api.php`)
- Authentication → User identity: authenticates users (evidence: `app/Http/Controllers/AuthController.php`)
- Support-log API → Support-log records: queries and updates (evidence: `app/Http/Controllers/SupportLogController.php`)
- Support-log API → Application database: persists log changes (evidence: `app/Http/Controllers/SupportLogController.php`)
- Support-log API → Log response resource: returns log data
- Support-log records → Departments: references department (evidence: `app/Models/SupportLog.php`)
- Support-log records → Item types: references item type (evidence: `app/Models/SupportLog.php`)
- Support-log records → Issue types: relates issue types (evidence: `app/Models/SupportLog.php`)
- Support-log records → User identity: references users (evidence: `app/Models/SupportLog.php`)
- Support-log records → Log assignments: has assignments (evidence: `app/Models/SupportLog.php`)
- Department API → Departments: queries and updates (evidence: `app/Http/Controllers/DepartmentController.php`)
- Department API → Application database: persists changes (evidence: `app/Http/Controllers/DepartmentController.php`)
- Item-type API → Item types: queries and updates (evidence: `app/Http/Controllers/ItemController.php`)
- Item-type API → Application database: persists changes (evidence: `app/Http/Controllers/ItemController.php`)
- Issue-type API → Issue types: queries and updates (evidence: `app/Http/Controllers/IssueController.php`)
- User administration → User identity: queries and updates (evidence: `app/Http/Controllers/UserController.php`)
- Role API → Roles: queries roles (evidence: `app/Http/Controllers/RoleController.php`)
- Permission API → Permissions: manages permissions (evidence: `app/Http/Controllers/PermissionController.php`)
- Permission API → Roles: loads role relation (evidence: `app/Http/Controllers/PermissionController.php`)
- Role permissions → Roles: updates role grants (evidence: `app/Http/Controllers/RolePermissionController.php`)
- Role permissions → Permissions: assigns permissions (evidence: `app/Http/Controllers/RolePermissionController.php`)
- Roles → Permissions: links permissions (evidence: `app/Models/Role.php`)
- User identity → Roles: belongs to role (evidence: `app/Models/User.php`)
- Performance dashboard → Support-log records: aggregates log data (evidence: `app/Http/Controllers/DashboardController.php`)
- Performance dashboard → User identity: summarizes users (evidence: `app/Http/Controllers/DashboardController.php`)
