<?php

namespace App\Models;

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

class GeneralJournal extends Model
{
    use HasFactory;

    protected $table = 'general_journals';
    protected $fillable = [
        'date',
        'account_id',
        'narration',
        'reference',
        'currency_id',
        'project_id',
        'tr_code',
        'amount'
    ];

    public function account()
    {
        return $this->belongsTo(GeneralLedger::class, 'account_id');
    }

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

    public function currency()
    {
        return $this->belongsTo(Currency::class);
    }
// Add customer_id relationship if it doesn't exist
public function customer()
{
    return $this->belongsTo(CustomerAccount::class, 'customer_id');
}
}