<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class PayrollTransaction extends Model
{
    use HasFactory;

    protected $fillable = [
        'org_id',
        'payroll_id',
        'payroll_employee_id',
        'transaction_ref',
        'bulk_reference',
        'transaction_type',
        'amount',
        'destination_account',
        'destination_account_name',
        'destination_bank_code',
        'destination_narration',
        'status',
        'remita_status',
        'meta',
    ];

    protected $casts = [
        'meta' => 'array',
        'amount' => 'decimal:2',
    ];

    public function organisation()
    {
        return $this->belongsTo(Organisation::class, "org_id");
    }

    public function payroll()
    {
        return $this->belongsTo(Payroll::class);
    }
}
