<?php

namespace App\Models;

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

class FinancialTransaction extends Model
{
    use HasFactory;

    protected $fillable = ['type', 'category', 'amount', 'payment_method', 'reference', 'description', 'transaction_date', 'created_by', 'updated_by'];

    protected $casts = ['amount' => 'decimal:2', 'transaction_date' => 'date'];

    public function creator()
    {
        return $this->belongsTo(User::class, 'created_by');
    }
}
