# viccodem/sistemarh_laravel architecture

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

- Interactive diagram: https://gitdiagram.com/viccodem/sistemarh_laravel
- Repository: https://github.com/viccodem/sistemarh_laravel

## Overview

1. **Overall shape**
   - This is a Laravel 13 monolith for an HR system. The app is organized around role-specific back office screens, with Blade views for most pages and Livewire for richer interactive areas.
   - The main runtime boundary is the standard Laravel request cycle: routes → middleware/auth/policies → controllers or Livewire components → services/models → database.

2. **Access and identity**
   - Authentication is handled with the built-in Laravel auth stack under `app/Http/Controllers/Auth` and `routes/auth.php`.
   - Role enforcement is explicit via `app/Http/Middleware/CheckRole.php`, which likely separates admin, empresa, candidato, and internal user access.
   - Profile management is a separate concern (`ProfileController`, profile requests, profile views), alongside password and email verification flows.

3. **Primary business domains**
   - The core entities are `Empresa`, `Vacante`, `Candidato`, `Postulacion`, `Ticket`, `ChatRoom`, `ChatMessage`, `CatalogoServicio`, `ServicioAsignado`, and `PersonalExterno`.
   - These are represented as Eloquent models in `app/Models` and backed by dedicated migrations, so the database schema is a first-class part of the architecture.

4. **Candidate / recruitment flow**
   - Candidate-facing pages live under `resources/views/candidato`, with a Livewire component `CandidatoSolicitud` for interactive application or request submission.
   - The likely flow is candidate browsing vacancies, submitting applications (`Postulacion`), and tracking status in candidate views.
   - `CandidatoService` and `PostulacionService` indicate business rules are not kept only in controllers; they are extracted into services.

5. **Empresa (company) workspace**
   - Company users have their own controller and dashboard area under `app/Http/Controllers/Empresa` and `resources/views/empresa`.
   - This area manages vacancies and “solicitudes” through standard create/edit/show/index screens, suggesting company-side intake and vacancy lifecycle management.
   - The presence of `vacantes/matching.blade.php` suggests there is a matching or evaluation step between vacancy requirements and candidate profiles.

6. **Admin back office**
   - Admin controllers and views cover management screens for empresas, candidatos, vacantes, catálogo de servicios, and personal externo.
   - This is the administrative control plane for CRUD, moderation, and operational oversight rather than end-user interaction.
   - Modal-based UI fragments in admin views suggest many admin actions are handled inline without full-page navigation.

7. **Workflow, SLA, and service orchestration**
   - `WorkflowService` and `SlaInteligenteService` indicate a rules-driven layer for business process transitions and deadline handling, especially around tickets.
   - `config/workflow.php` and `config/sla.php` make these behaviors configurable, so process logic is not hard-coded into controllers.
   - Ticket migrations include SLA fields, showing that response/resolve timing is part of the data model, not just presentation.

8. **Ticketing subsystem**
   - Tickets and ticket messages form a separate support/operations stream with their own CRUD pages under `resources/views/tickets`.
   - This subsystem is likely used to track issues, requests, or internal support cases across roles.
   - The `Ticket`/`TicketMessage` split indicates threaded conversations attached to a case record.

9. **Chat subsystem**
   - Real-time or near-real-time messaging is implemented with Livewire components: `ChatList` and `ChatConversacion`.
   - Persistence is modeled with `ChatRoom`, `ChatRoomMember`, and `ChatMessage`, which implies group or direct room membership rather than simple one-to-one messages.
   - Chat has dedicated views under `resources/views/chat` and `resources/views/livewire/chat`, separating page shell from component rendering.

10. **Interactive UI layer**
   - Livewire is used for the more dynamic screens: candidate submission, chat, and a `KanbanBoard` component.
   - The Kanban board is likely tied to tracking states for vacancies, applications, or tickets, giving the system a visual workflow view.
   - Most other UI is standard Blade layouts and components, with shared layout shells in `resources/views/layouts` and reusable form/button components in `resources/views/components`.

11. **Authorization and domain rules**
   - `CandidatoPolicy` and `VacantePolicy` enforce object-level access control, complementing role middleware.
   - This suggests the app distinguishes between “who may enter a section” and “who may act on a specific record”.
   - Controllers likely stay thin on permission logic, deferring to policies and services.

12. **Persistence and supporting infrastructure**
   - Data is stored in a relational database via migrations and seeded with `DatabaseSeeder` and `DummyDataSeeder`.
   - Standard Laravel support tables are present for cache, jobs, notifications, and activity logging, indicating the app uses framework-backed operational features.
   - `storage/` is the usual Laravel boundary for logs, cached views, sessions, and file uploads.

13. **Frontend/tooling boundary**
   - The app uses Laravel’s Blade stack with Vite, Tailwind, and app-specific JS/CSS entrypoints under `resources/js` and `resources/css`.
   - The frontend is not a separate SPA; it is server-rendered pages enhanced by Livewire and compiled assets.

14. **How the pieces connect**
   - A typical request path is: user enters through `routes/web.php` or `routes/auth.php`, middleware checks role/auth state, a controller or Livewire component invokes a service, the service reads/writes Eloquent models, and the result is rendered into Blade.
   - The most important diagram boundaries are: authentication/authorization, role-specific workspaces, operational support (tickets/chat), and the shared data model underneath them.

Main entry points: [`routes/web.php`](https://github.com/viccodem/sistemarh_laravel/blob/main/routes/web.php) (Web routes), [`app/Models`](https://github.com/viccodem/sistemarh_laravel/tree/main/app/Models) (Core models), [`app/Http/Middleware/CheckRole.php`](https://github.com/viccodem/sistemarh_laravel/blob/main/app/Http/Middleware/CheckRole.php) (Role gate), [`resources/views/candidato`](https://github.com/viccodem/sistemarh_laravel/tree/main/resources/views/candidato) (Candidato area)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_grp_access["Access & Auth"]
  node_routes_web["Web routes<br/>[web.php]"]
  node_routes_auth["Auth routes<br/>[auth.php]"]
  node_middleware_role{{"Role gate<br/>middleware<br/>[CheckRole.php]"}}
  node_auth_ctrls["Auth flow<br/>controllers"]
  node_profile_ctrl["Profile<br/>controller"]
end

subgraph group_grp_workspaces["Role Workspaces"]
  node_empresa_ws["Empresa area<br/>workspace controllers"]
  node_admin_ws["Admin area<br/>back-office controllers"]
  node_candidato_ui["Candidato area<br/>candidate views"]
end

subgraph group_grp_ops["Operations"]
  node_ticket_ctrl["Tickets<br/>controller"]
  node_chat_livewire["Chat UI<br/>livewire"]
  node_kanban_lw["Kanban board<br/>livewire<br/>[KanbanBoard.php]"]
end

subgraph group_grp_domain["Domain & Data"]
  node_workflow_sla["Workflow rules<br/>services"]
  node_candidato_service["Candidato service"]
  node_postulacion_service["Postulacion service"]
  node_models_core[("Core models<br/>eloquent models")]
  node_policies{{"Policies<br/>authorization"}}
  node_migrations[("Schema<br/>migrations")]
  node_seeders["Seed data<br/>seeders"]
end

subgraph group_grp_ui["UI & App Shell"]
  node_views_shell["View shell<br/>blade layouts"]
  node_livewire_views["Livewire views<br/>blade views"]
  node_assets["Assets<br/>frontend build<br/>[app.js]"]
end

node_routes_auth -->|"dispatches"| node_auth_ctrls
node_routes_web -->|"guards"| node_middleware_role
node_middleware_role -->|"allows"| node_empresa_ws
node_middleware_role -->|"allows"| node_admin_ws
node_middleware_role -->|"allows"| node_candidato_ui
node_routes_web -->|"dispatches"| node_profile_ctrl
node_routes_web -->|"dispatches"| node_ticket_ctrl
node_routes_web -->|"mounts"| node_chat_livewire
node_routes_web -->|"mounts"| node_kanban_lw
node_empresa_ws -->|"reads/writes"| node_models_core
node_admin_ws -->|"manages"| node_models_core
node_candidato_ui -->|"uses"| node_candidato_service
node_candidato_ui -->|"uses"| node_postulacion_service
node_ticket_ctrl -->|"applies"| node_workflow_sla
node_chat_livewire -->|"persists"| node_models_core
node_kanban_lw -->|"visualizes"| node_workflow_sla
node_workflow_sla -->|"updates"| node_models_core
node_policies -->|"protects"| node_models_core
node_migrations -->|"defines"| node_models_core
node_seeders -->|"bootstraps"| node_migrations
node_views_shell -->|"renders"| node_empresa_ws
node_views_shell -->|"renders"| node_admin_ws
node_livewire_views -->|"renders"| node_chat_livewire
node_livewire_views -->|"renders"| node_kanban_lw
node_assets -->|"supports"| node_views_shell

click node_routes_web "https://github.com/viccodem/sistemarh_laravel/blob/main/routes/web.php"
click node_routes_auth "https://github.com/viccodem/sistemarh_laravel/blob/main/routes/auth.php"
click node_middleware_role "https://github.com/viccodem/sistemarh_laravel/blob/main/app/Http/Middleware/CheckRole.php"
click node_auth_ctrls "https://github.com/viccodem/sistemarh_laravel/tree/main/app/Http/Controllers/Auth"
click node_profile_ctrl "https://github.com/viccodem/sistemarh_laravel/blob/main/app/Http/Controllers/ProfileController.php"
click node_empresa_ws "https://github.com/viccodem/sistemarh_laravel/blob/main/app/Http/Controllers/Empresa/EmpresaController.php"
click node_admin_ws "https://github.com/viccodem/sistemarh_laravel/blob/main/app/Http/Controllers/Admin/AdminController.php"
click node_candidato_ui "https://github.com/viccodem/sistemarh_laravel/tree/main/resources/views/candidato"
click node_ticket_ctrl "https://github.com/viccodem/sistemarh_laravel/blob/main/app/Http/Controllers/TicketController.php"
click node_chat_livewire "https://github.com/viccodem/sistemarh_laravel/tree/main/app/Livewire/Chat"
click node_kanban_lw "https://github.com/viccodem/sistemarh_laravel/blob/main/app/Livewire/KanbanBoard.php"
click node_workflow_sla "https://github.com/viccodem/sistemarh_laravel/blob/main/app/Services/WorkflowService.php"
click node_candidato_service "https://github.com/viccodem/sistemarh_laravel/blob/main/app/Services/CandidatoService.php"
click node_postulacion_service "https://github.com/viccodem/sistemarh_laravel/blob/main/app/Services/PostulacionService.php"
click node_models_core "https://github.com/viccodem/sistemarh_laravel/tree/main/app/Models"
click node_policies "https://github.com/viccodem/sistemarh_laravel/tree/main/app/Policies"
click node_migrations "https://github.com/viccodem/sistemarh_laravel/tree/main/database/migrations"
click node_seeders "https://github.com/viccodem/sistemarh_laravel/tree/main/database/seeders"
click node_views_shell "https://github.com/viccodem/sistemarh_laravel/tree/main/resources/views/layouts"
click node_livewire_views "https://github.com/viccodem/sistemarh_laravel/tree/main/resources/views/livewire"
click node_assets "https://github.com/viccodem/sistemarh_laravel/blob/main/resources/js/app.js"

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_routes_web,node_routes_auth,node_middleware_role,node_auth_ctrls,node_profile_ctrl toneBlue
class node_empresa_ws,node_admin_ws,node_candidato_ui toneAmber
class node_ticket_ctrl,node_chat_livewire,node_kanban_lw toneMint
class node_workflow_sla,node_candidato_service,node_postulacion_service,node_models_core,node_policies,node_migrations,node_seeders toneRose
class node_views_shell,node_livewire_views,node_assets toneIndigo
```

## Components

### Access & Auth

Authentication, role gates, and profile management

- [Web routes](https://github.com/viccodem/sistemarh_laravel/blob/main/routes/web.php): routes · Main HTTP route entrypoint · `routes/web.php`
- [Auth routes](https://github.com/viccodem/sistemarh_laravel/blob/main/routes/auth.php): routes · Login, registration, and verification routes · `routes/auth.php`
- [Role gate](https://github.com/viccodem/sistemarh_laravel/blob/main/app/Http/Middleware/CheckRole.php): middleware · Role-based access filter · `app/Http/Middleware/CheckRole.php`
- [Auth flow](https://github.com/viccodem/sistemarh_laravel/tree/main/app/Http/Controllers/Auth): controllers · Session, registration, password, and verification controllers · `app/Http/Controllers/Auth`
- [Profile](https://github.com/viccodem/sistemarh_laravel/blob/main/app/Http/Controllers/ProfileController.php): controller · Profile settings and account updates · `app/Http/Controllers/ProfileController.php`

### Role Workspaces

Main user-facing areas by role

- [Empresa area](https://github.com/viccodem/sistemarh_laravel/blob/main/app/Http/Controllers/Empresa/EmpresaController.php): workspace controllers · Company dashboard and vacancy management · `app/Http/Controllers/Empresa/EmpresaController.php`
- [Admin area](https://github.com/viccodem/sistemarh_laravel/blob/main/app/Http/Controllers/Admin/AdminController.php): back-office controllers · Administrative control panel for core entities · `app/Http/Controllers/Admin/AdminController.php`
- [Candidato area](https://github.com/viccodem/sistemarh_laravel/tree/main/resources/views/candidato): candidate views · Candidate-facing vacancy and application screens · `resources/views/candidato`

### Operations

Support, chat, and workflow subsystems

- [Tickets](https://github.com/viccodem/sistemarh_laravel/blob/main/app/Http/Controllers/TicketController.php): controller · Ticket case CRUD and detail views · `app/Http/Controllers/TicketController.php`
- [Chat UI](https://github.com/viccodem/sistemarh_laravel/tree/main/app/Livewire/Chat): livewire · Interactive room list and conversation components · `app/Livewire/Chat`
- [Kanban board](https://github.com/viccodem/sistemarh_laravel/blob/main/app/Livewire/KanbanBoard.php): livewire · Visual workflow board for states and tracking · `app/Livewire/KanbanBoard.php`

### Domain & Data

Core models, services, and database layer

- [Workflow rules](https://github.com/viccodem/sistemarh_laravel/blob/main/app/Services/WorkflowService.php): services · Business process transitions and SLA handling · `app/Services/WorkflowService.php`
- [Candidato service](https://github.com/viccodem/sistemarh_laravel/blob/main/app/Services/CandidatoService.php): service · Candidate domain rules and application support · `app/Services/CandidatoService.php`
- [Postulacion service](https://github.com/viccodem/sistemarh_laravel/blob/main/app/Services/PostulacionService.php): service · Application lifecycle rules · `app/Services/PostulacionService.php`
- [Core models](https://github.com/viccodem/sistemarh_laravel/tree/main/app/Models): eloquent models · Primary entities for HR, tickets, chat, and services · `app/Models`
- [Policies](https://github.com/viccodem/sistemarh_laravel/tree/main/app/Policies): authorization · Object-level access control for key records · `app/Policies`
- [Schema](https://github.com/viccodem/sistemarh_laravel/tree/main/database/migrations): migrations · Database tables and structural evolution · `database/migrations`
- [Seed data](https://github.com/viccodem/sistemarh_laravel/tree/main/database/seeders): seeders · Database bootstrap and sample data · `database/seeders`

### UI & App Shell

Shared views, components, and runtime entrypoints

- [View shell](https://github.com/viccodem/sistemarh_laravel/tree/main/resources/views/layouts): blade layouts · Shared layouts and reusable Blade components · `resources/views/layouts`
- [Livewire views](https://github.com/viccodem/sistemarh_laravel/tree/main/resources/views/livewire): blade views · Component templates for dynamic screens · `resources/views/livewire`
- [Assets](https://github.com/viccodem/sistemarh_laravel/blob/main/resources/js/app.js): frontend build · Compiled JS and CSS entrypoints · `resources/js/app.js`

## Connections

- Auth routes → Auth flow: dispatches · Auth routes are handled by the auth controllers
- Web routes → Role gate: guards · Web requests pass through role checks where required
- Role gate → Empresa area: allows · Role filtering gates company workspace access
- Role gate → Admin area: allows · Role filtering gates admin workspace access
- Role gate → Candidato area: allows · Role filtering gates candidate pages
- Web routes → Profile: dispatches · Profile routes reach the profile controller
- Web routes → Tickets: dispatches · Ticket routes reach the ticket controller
- Web routes → Chat UI: mounts · Chat routes render Livewire components
- Web routes → Kanban board: mounts · Workflow board is exposed as a Livewire screen
- Empresa area → Core models: reads/writes · Company screens operate on vacancies and related records
- Admin area → Core models: manages · Admin screens manage core entities
- Candidato area → Candidato service: uses · Candidate screens call domain logic
- Candidato area → Postulacion service: uses · Applications are coordinated through service logic
- Tickets → Workflow rules: applies · Ticket handling uses workflow and SLA rules
- Chat UI → Core models: persists · Chat components read and store room and message data
- Kanban board → Workflow rules: visualizes · Board reflects process states driven by workflow rules
- Workflow rules → Core models: updates · Workflow and SLA services operate on domain records
- Policies → Core models: protects · Policies enforce record-level access on core models
- Schema → Core models: defines · Migrations back the model layer with table schema
- Seed data → Schema: bootstraps · Seeders populate the database created by migrations
- View shell → Empresa area: renders · Shared layouts wrap workspace pages
- View shell → Admin area: renders · Shared layouts wrap admin pages
- Livewire views → Chat UI: renders · Livewire templates back chat components
- Livewire views → Kanban board: renders · Livewire templates back the kanban board
- Assets → View shell: supports · Compiled frontend assets support Blade layouts
