---
tags: [products, model]
module: Products
---

# [Model]CostCenter

## Connections
[[_Products]] · [[[Model]WarehouseProduct]] · [[[Service]CostCenterServices]] · [[[Repo]Repositories]] · [[[Controller]CostCenterController]] · [[[Observer]Observers]] · [[[Cross]CrossModuleDependencies]]

## Source
`Modules/Products/Models/CostCenter.php` · `Modules/Products/Models/CostCenterIntegration.php`

## Responsibilities
- Hierarchical cost center (parent_id self-ref) with auto-generated hierarchical code
- Links to: JournalRecord, Invoice, InvoiceReturn, PurchaseBill, BillReturn, Expense, PaymentReceipts
- CostCenterIntegration: maps 3rd-party branch (Foodics, Marn, Prexle, LazyWait) → local CostCenter
- AuditableTrait, CascadeSoftDeletes, FormatDateAndTimeTrait, HasTranslatableFields, UsesTenantConnection

## Key Relationships
| Relation | Type | Target |
|---|---|---|
| parent | belongsTo | CostCenter (self) |
| children | hasMany | CostCenter (self) |
| `childrenWithChildren()` | recursive | deep hierarchy |
| integrations | hasMany | CostCenterIntegration |

## CostCenterIntegration Fields
`branch_id` · `integration_type` (Foodics/Marn/Prexle/LazyWait) · `is_active`
