<?php
namespace App\Models;

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

class CashbookTempEntry extends Model
{
    use HasFactory;

    protected $table = 'cashbook_temp_entries';
    protected $fillable = [
        'cashbook_id', 'date', 'module', 'account_id', 'account_type', 
        'reference_id', 'reference_type', 'description',
        'tr_code', 'currency_id', 'project_id' ,'amount', 'dr_amount', 'cr_amount', 'status'
    ];

    public function currency()
    {
        return $this->belongsTo(Currency::class);
    }
     public function project()
    {
        return $this->belongsTo(Project::class);
    }

    public function cashbook()
    {
        return $this->belongsTo(Cashbook::class);
    }

    public function account()
    {
        return $this->morphTo();
    }

    public function reference()
    {
        return $this->morphTo();
    }
}