<?php

namespace App\Models;

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

class SubAccount extends Model
{
    use HasFactory;
    protected $table = "sub_accounts";
    protected $fillable = ['code','account_code','sub_code','sub_name', 'parent_id'];
// SubAccount.php
public function mainAccount()
{
    return $this->belongsTo(GeneralLedger::class, 'parent_id');
}

}