---
tags: [attachments, model]
module: Attachments
---

# GeneralAttachment

## Connections
[[_Attachments]] · [[[Repo]GeneralAttachmentsRepository]] · [[[Service]AttachmentServices]] · [[[Controller]GeneralAttachmentController]] · [[[DB]DatabaseTables]] · [[[Cross]CrossModuleDependencies]] · [[[Model]User]]

## Source
```
Modules/Attachments/Models/GeneralAttachment.php
```

## Responsibilities
- Stores uploaded files before they are attached to a specific document
- `is_attached = false` means file is staged but not yet linked to an Invoice/Bill/Expense
- `is_attached = true` means the file has been moved and linked to a specific document
- Auditable — tracks created/updated/deleted events

## Key Relationships

| Relation | Type | Target |
|---|---|---|
| addedBy | belongsTo (withTrashed) | [[[Cross]CrossModuleDependencies#CompanyUser]] User |
| deletedBy | belongsTo (withTrashed) | [[[Cross]CrossModuleDependencies#CompanyUser]] User |
| customer | belongsTo (withTrashed) | [[[Cross]CrossModuleDependencies#Sales]] Customer |
| supplier | belongsTo (withTrashed) | [[[Cross]CrossModuleDependencies#Purchases]] Supplier |
| invoice | belongsTo (withTrashed) | [[[Cross]CrossModuleDependencies#Sales]] Invoice |
| bill | belongsTo (withTrashed) | [[[Cross]CrossModuleDependencies#Purchases]] PurchaseBill |
| expense | belongsTo (withTrashed) | [[[Cross]CrossModuleDependencies#Purchases]] Expense |

## Key Columns
`title` · `type` (MIME) · `path` · `size` · `is_attached` · `added_by` · `deleted_by` · `customer_id` · `supplier_id` · `invoice_id` · `bill_id` · `expense_id`

## Constants
`UPLOAD_PATH = 'general_attachments'`

## Traits
`AuditableTrait` · `SoftDeletes` · `UsesTenantConnection`
