---
tags: [purchases, model]
module: Purchases
---

# [Model]Supplier

## Connections
[[_Purchases]] · [[[Model]PurchaseBill]] · [[[Model]BillReturn]] · [[[Model]Expense]] · [[[Model]SupplierPaymentReceipt]] · [[[Controller]Controllers]] · [[[Service]SupplierServices]] · [[[Repo]Repositories]] · [[[Cross]CrossModuleDependencies]]

## Source
`Modules/Purchases/Models/Supplier.php`

## Responsibilities
- Represents a vendor/supplier entity with balance tracking
- Supports integration sync (Foodics, MARN, Prexle) via `integration_type` + `integration_reference`
- Eager-loads `accounts` relationship by default
- Balance managed via `current_balance` / `opening_balance` (decimal 11,2)
- Auditable, SoftDeletes, Dropdownable, UsesTenantConnection

## Key Relationships
| Relation | Type | Target |
|---|---|---|
| accounts | belongsToMany | Account (Accounting) via `account_supplier` pivot |
| receipts | hasMany | SupplierPaymentReceipt |
| allReceipts | hasMany | SupplierPaymentReceipt (withTrashed) |
| bills | hasMany | PurchaseBill |
| billReturns | hasMany | BillReturn |
| expenses | hasMany | Expense |
| journalRecords | hasMany | JournalRecord (Accounting) |
| addedBy / updatedBy | belongsTo | User (CompanyUser) withTrashed |

## Accessors / Mutators
`current_balance` · `opening_balance` (trimNumber) · `mobile_formatted` (formatMobile getter)

## Pivot Table
`account_supplier` — `account_id` + `supplier_id`
