---
tags: [hr, model]
module: HR
---

# PayrollEntry

## Connections
[[_HR]] · [[[Model]Employee]] · [[[Model]Account]] · [[[Model]JournalEntry]] · [[[Model]FiscalYear]] · [[[Model]User]] · [[[Repo]Repositories]] · [[[Controller]PayrollEntriesController]] · [[[Service]PayrollServices]] · [[[DB]DatabaseTables]]

## Source
```
Modules/HR/Models/PayrollEntry.php
Modules/HR/Models/PayrollEntryDetail.php
```

## Responsibilities
- Monthly payroll run — one `PayrollEntry` per month, N `PayrollEntryDetail` rows (one per employee)
- Automatically creates a [[[Model]JournalEntry]] on store/update
- `payment_account_id` = credit account (bank/cash); employee `cost_account_id` = debit account

## Key Relationships

| Relation | Type | Target |
|---|---|---|
| paymentAccount | belongsTo (withTrashed) | [[[Model]Account]] (`payment_account_id`) |
| fiscalYear | belongsTo | [[[Model]FiscalYear]] (`year_id`) |
| journalEntry | belongsTo (withTrashed) | [[[Model]JournalEntry]] (`journal_entry_id`) |
| user (created_by) | belongsTo (withTrashed) | [[[Model]User]] |
| payrollEntryDetails | hasMany | PayrollEntryDetail |
| PayrollEntryDetail.employee | belongsTo (withTrashed) | [[[Model]Employee]] |
| PayrollEntryDetail.user | belongsTo (withTrashed) | [[[Model]User]] |

## Traits
`AuditableTrait` · `SoftDeletes` · `UsesTenantConnection` (both models)
