# ericmuga/cm_weighing architecture

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

- Interactive diagram: https://gitdiagram.com/ericmuga/cm_weighing
- Repository: https://github.com/ericmuga/cm_weighing

## Overview

This Laravel application supports slaughter-floor receipt and weighing work, QA carcass grading, butchery/deboning, stock transfers, and customer/login workflows. A web request is routed to a controller, which performs domain operations and returns a view or report; controllers also read and write relational data. The excerpts show scale-service calls and several reporting exports. The README describes Laravel generally rather than documenting this application’s capabilities, and unsampled route/controller details are represented conservatively.

Main entry points: [`routes/web.php`](https://github.com/ericmuga/cm_weighing/blob/master/routes/web.php) (Web routes), [`app/Http/Controllers/SlaughterController.php`](https://github.com/ericmuga/cm_weighing/blob/master/app/Http/Controllers/SlaughterController.php) (Slaughter workflow), [`app/Http/Controllers/QAController.php`](https://github.com/ericmuga/cm_weighing/blob/master/app/Http/Controllers/QAController.php) (QA grading), [`app/Http/Controllers/StockController.php`](https://github.com/ericmuga/cm_weighing/blob/master/app/Http/Controllers/StockController.php) (Stock and transfers)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Web entry"]
  node_web_routes["Web routes<br/>[web.php]"]
  node_login["Login"]
  node_customers["Customer management"]
end

subgraph group_slaughter["Slaughter operations"]
  node_slaughter_ctrl["Slaughter workflow"]
  node_receipt_event["Receipt completion event"]
  node_event_listener["Grading action listener"]
  node_slaughter_exports["Slaughter reports"]
  node_offal_exports["Offal reports"]
  node_slaughter_view["Slaughter screens<br/>[weigh.blade.php]"]
end

subgraph group_quality["QA grading"]
  node_qa_ctrl["QA grading<br/>[QAController.php]"]
  node_grading_service["Grading rules"]
  node_qa_exports["QA reports"]
  node_slaughter_grade_export["Slaughter grading reports"]
  node_qa_view["QA screens"]
end

subgraph group_production["Production and stock"]
  node_butchery_ctrl["Deboning workflow"]
  node_deboning_exports["Deboning reports"]
  node_stock_ctrl["Stock and transfers"]
  node_idt_exports["Transfer reports"]
  node_items["Product catalogue<br/>[Item.php]"]
  node_butchery_view["Butchery screens<br/>[scale3.blade.php]"]
  node_stock_view["Stock screens"]
end

subgraph group_shared["Shared services"]
  node_database[("Application database")]
  node_helpers["Shared helpers<br/>[Helpers.php]"]
end

node_operator(("Staff user"))
node_scale_service["Scale service"]

node_operator -->|"submits requests"| node_web_routes
node_web_routes -->|"routes to"| node_login
node_web_routes -->|"routes to"| node_customers
node_web_routes -->|"routes to"| node_slaughter_ctrl
node_web_routes -->|"routes to"| node_qa_ctrl
node_web_routes -->|"routes to"| node_butchery_ctrl
node_web_routes -->|"routes to"| node_stock_ctrl
node_slaughter_ctrl -->|"renders"| node_slaughter_view
node_qa_ctrl -->|"renders"| node_qa_view
node_butchery_ctrl -->|"renders"| node_butchery_view
node_stock_ctrl -->|"renders"| node_stock_view
node_slaughter_ctrl -->|"reads and writes"| node_database
node_qa_ctrl -->|"reads and writes"| node_database
node_butchery_ctrl -->|"reads and writes"| node_database
node_stock_ctrl -->|"reads and writes"| node_database
node_slaughter_ctrl -->|"dispatches"| node_receipt_event
node_event_listener -->|"handles"| node_receipt_event
node_slaughter_ctrl -->|"downloads"| node_offal_exports
node_slaughter_ctrl -->|"downloads"| node_slaughter_exports
node_qa_ctrl -->|"downloads"| node_qa_exports
node_qa_ctrl -->|"downloads"| node_slaughter_grade_export
node_qa_ctrl -.->|"uses grading rules"| node_grading_service
node_butchery_ctrl -->|"downloads"| node_deboning_exports
node_stock_ctrl -->|"downloads"| node_idt_exports
node_stock_ctrl -->|"queries products"| node_items
node_slaughter_ctrl -->|"uses"| node_helpers
node_butchery_ctrl -->|"uses"| node_helpers
node_stock_ctrl -->|"uses"| node_helpers
node_helpers -->|"calls over HTTP"| node_scale_service

click node_web_routes "https://github.com/ericmuga/cm_weighing/blob/master/routes/web.php"
click node_login "https://github.com/ericmuga/cm_weighing/blob/master/app/Http/Controllers/LoginController.php"
click node_customers "https://github.com/ericmuga/cm_weighing/blob/master/app/Http/Controllers/CustomerController.php"
click node_slaughter_ctrl "https://github.com/ericmuga/cm_weighing/blob/master/app/Http/Controllers/SlaughterController.php"
click node_receipt_event "https://github.com/ericmuga/cm_weighing/blob/master/app/Events/ReceiptsUploadCompleted.php"
click node_event_listener "https://github.com/ericmuga/cm_weighing/blob/master/app/Listeners/ToInsertForGradingActionListener.php"
click node_slaughter_exports "https://github.com/ericmuga/cm_weighing/blob/master/app/Exports/SlaughterSummaryExport.php"
click node_offal_exports "https://github.com/ericmuga/cm_weighing/blob/master/app/Exports/OffalsDataExportSummary.php"
click node_qa_ctrl "https://github.com/ericmuga/cm_weighing/blob/master/app/Http/Controllers/QAController.php"
click node_grading_service "https://github.com/ericmuga/cm_weighing/blob/master/app/Models/CarcassGradingService.php"
click node_qa_exports "https://github.com/ericmuga/cm_weighing/blob/master/app/Exports/QAGradingReportExport.php"
click node_slaughter_grade_export "https://github.com/ericmuga/cm_weighing/blob/master/app/Exports/SlaughterGradingReportExport.php"
click node_butchery_ctrl "https://github.com/ericmuga/cm_weighing/blob/master/app/Http/Controllers/ButcheryController.php"
click node_deboning_exports "https://github.com/ericmuga/cm_weighing/blob/master/app/Exports/DeboningReportSummaryExport.php"
click node_stock_ctrl "https://github.com/ericmuga/cm_weighing/blob/master/app/Http/Controllers/StockController.php"
click node_idt_exports "https://github.com/ericmuga/cm_weighing/blob/master/app/Exports/IDTSummaryExport.php"
click node_items "https://github.com/ericmuga/cm_weighing/blob/master/app/Models/Item.php"
click node_helpers "https://github.com/ericmuga/cm_weighing/blob/master/app/Models/Helpers.php"
click node_slaughter_view "https://github.com/ericmuga/cm_weighing/blob/master/resources/views/slaughter/weigh.blade.php"
click node_qa_view "https://github.com/ericmuga/cm_weighing/blob/master/resources/views/QA/grading-v2.blade.php"
click node_butchery_view "https://github.com/ericmuga/cm_weighing/blob/master/resources/views/butchery/scale3.blade.php"
click node_stock_view "https://github.com/ericmuga/cm_weighing/blob/master/resources/views/stocks/issue_transfers.blade.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_web_routes,node_login,node_customers,node_operator toneBlue
class node_slaughter_ctrl,node_receipt_event,node_event_listener,node_slaughter_exports,node_offal_exports,node_slaughter_view toneAmber
class node_qa_ctrl,node_grading_service,node_qa_exports,node_slaughter_grade_export,node_qa_view toneMint
class node_butchery_ctrl,node_deboning_exports,node_stock_ctrl,node_idt_exports,node_items,node_butchery_view,node_stock_view toneRose
class node_database,node_helpers,node_scale_service toneIndigo
```

## Components

### Web entry

- [Web routes](https://github.com/ericmuga/cm_weighing/blob/master/routes/web.php): `routes/web.php`
- [Login](https://github.com/ericmuga/cm_weighing/blob/master/app/Http/Controllers/LoginController.php): `app/Http/Controllers/LoginController.php`
- [Customer management](https://github.com/ericmuga/cm_weighing/blob/master/app/Http/Controllers/CustomerController.php): `app/Http/Controllers/CustomerController.php`

### Slaughter operations

- [Slaughter workflow](https://github.com/ericmuga/cm_weighing/blob/master/app/Http/Controllers/SlaughterController.php): `app/Http/Controllers/SlaughterController.php`
- [Receipt completion event](https://github.com/ericmuga/cm_weighing/blob/master/app/Events/ReceiptsUploadCompleted.php): `app/Events/ReceiptsUploadCompleted.php`
- [Grading action listener](https://github.com/ericmuga/cm_weighing/blob/master/app/Listeners/ToInsertForGradingActionListener.php): `app/Listeners/ToInsertForGradingActionListener.php`
- [Slaughter reports](https://github.com/ericmuga/cm_weighing/blob/master/app/Exports/SlaughterSummaryExport.php): `app/Exports/SlaughterSummaryExport.php`
- [Offal reports](https://github.com/ericmuga/cm_weighing/blob/master/app/Exports/OffalsDataExportSummary.php): `app/Exports/OffalsDataExportSummary.php`
- [Slaughter screens](https://github.com/ericmuga/cm_weighing/blob/master/resources/views/slaughter/weigh.blade.php): `resources/views/slaughter/weigh.blade.php`

### QA grading

- [QA grading](https://github.com/ericmuga/cm_weighing/blob/master/app/Http/Controllers/QAController.php): `app/Http/Controllers/QAController.php`
- [Grading rules](https://github.com/ericmuga/cm_weighing/blob/master/app/Models/CarcassGradingService.php): `app/Models/CarcassGradingService.php`
- [QA reports](https://github.com/ericmuga/cm_weighing/blob/master/app/Exports/QAGradingReportExport.php): `app/Exports/QAGradingReportExport.php`
- [Slaughter grading reports](https://github.com/ericmuga/cm_weighing/blob/master/app/Exports/SlaughterGradingReportExport.php): `app/Exports/SlaughterGradingReportExport.php`
- [QA screens](https://github.com/ericmuga/cm_weighing/blob/master/resources/views/QA/grading-v2.blade.php): `resources/views/QA/grading-v2.blade.php`

### Production and stock

- [Deboning workflow](https://github.com/ericmuga/cm_weighing/blob/master/app/Http/Controllers/ButcheryController.php): `app/Http/Controllers/ButcheryController.php`
- [Deboning reports](https://github.com/ericmuga/cm_weighing/blob/master/app/Exports/DeboningReportSummaryExport.php): `app/Exports/DeboningReportSummaryExport.php`
- [Stock and transfers](https://github.com/ericmuga/cm_weighing/blob/master/app/Http/Controllers/StockController.php): `app/Http/Controllers/StockController.php`
- [Transfer reports](https://github.com/ericmuga/cm_weighing/blob/master/app/Exports/IDTSummaryExport.php): `app/Exports/IDTSummaryExport.php`
- [Product catalogue](https://github.com/ericmuga/cm_weighing/blob/master/app/Models/Item.php): `app/Models/Item.php`
- [Butchery screens](https://github.com/ericmuga/cm_weighing/blob/master/resources/views/butchery/scale3.blade.php): `resources/views/butchery/scale3.blade.php`
- [Stock screens](https://github.com/ericmuga/cm_weighing/blob/master/resources/views/stocks/issue_transfers.blade.php): `resources/views/stocks/issue_transfers.blade.php`

### Shared services

- **Application database**
- [Shared helpers](https://github.com/ericmuga/cm_weighing/blob/master/app/Models/Helpers.php): `app/Models/Helpers.php`

### Other components

- **Staff user**
- **Scale service**

## Connections

- Staff user → Web routes: submits requests (evidence: `routes/web.php`)
- Web routes → Login: routes to (evidence: `routes/web.php`)
- Web routes → Customer management: routes to (evidence: `routes/web.php`)
- Web routes → Slaughter workflow: routes to (evidence: `routes/web.php`)
- Web routes → QA grading: routes to (evidence: `routes/web.php`)
- Web routes → Deboning workflow: routes to (evidence: `routes/web.php`)
- Web routes → Stock and transfers: routes to (evidence: `routes/web.php`)
- Slaughter workflow → Slaughter screens: renders (evidence: `app/Http/Controllers/SlaughterController.php`)
- QA grading → QA screens: renders (evidence: `app/Http/Controllers/QAController.php`)
- Deboning workflow → Butchery screens: renders (evidence: `app/Http/Controllers/ButcheryController.php`)
- Stock and transfers → Stock screens: renders (evidence: `app/Http/Controllers/StockController.php`)
- Slaughter workflow → Application database: reads and writes (evidence: `app/Http/Controllers/SlaughterController.php`)
- QA grading → Application database: reads and writes (evidence: `app/Http/Controllers/QAController.php`)
- Deboning workflow → Application database: reads and writes (evidence: `app/Http/Controllers/ButcheryController.php`)
- Stock and transfers → Application database: reads and writes (evidence: `app/Http/Controllers/StockController.php`)
- Slaughter workflow → Receipt completion event: dispatches (evidence: `app/Http/Controllers/SlaughterController.php`)
- Grading action listener → Receipt completion event: handles (evidence: `app/Listeners/ToInsertForGradingActionListener.php`)
- Slaughter workflow → Offal reports: downloads (evidence: `app/Http/Controllers/SlaughterController.php`)
- Slaughter workflow → Slaughter reports: downloads (evidence: `app/Http/Controllers/SlaughterController.php`)
- QA grading → QA reports: downloads (evidence: `app/Http/Controllers/QAController.php`)
- QA grading → Slaughter grading reports: downloads (evidence: `app/Http/Controllers/QAController.php`)
- QA grading → Grading rules: uses grading rules (evidence: `app/Http/Controllers/QAController.php`)
- Deboning workflow → Deboning reports: downloads (evidence: `app/Http/Controllers/ButcheryController.php`)
- Stock and transfers → Transfer reports: downloads (evidence: `app/Http/Controllers/StockController.php`)
- Stock and transfers → Product catalogue: queries products (evidence: `app/Http/Controllers/StockController.php`)
- Slaughter workflow → Shared helpers: uses (evidence: `app/Http/Controllers/SlaughterController.php`)
- Deboning workflow → Shared helpers: uses (evidence: `app/Http/Controllers/ButcheryController.php`)
- Stock and transfers → Shared helpers: uses (evidence: `app/Http/Controllers/StockController.php`)
- Shared helpers → Scale service: calls over HTTP (evidence: `app/Models/Helpers.php`)
