<?php

namespace App\Models;

use App\Models\Concerns\BranchScoped;

use Illuminate\Database\Eloquent\Model;

class Expense extends Model
{
    use BranchScoped;
    protected $fillable = ['branch_id', 'expense_no', 'expense_date', 'expense_account_id', 'payment_account_id', 'taxable_amount', 'vat_amount', 'total_amount', 'reference', 'notes', 'attachment', 'journal_entry_id', 'created_by', 'status'];
    protected $casts = ['expense_date' => 'date', 'taxable_amount' => 'decimal:2', 'vat_amount' => 'decimal:2', 'total_amount' => 'decimal:2'];
    public function expenseAccount() { return $this->belongsTo(ChartOfAccount::class, 'expense_account_id'); }
    public function paymentAccount() { return $this->belongsTo(ChartOfAccount::class, 'payment_account_id'); }
    public function branch() { return $this->belongsTo(Branch::class); }
}
