<?php

namespace App\Models;

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

class SubAccount extends Model
{
    use HasFactory;
    protected $table = 'sub_accounts';
    protected $fillable = ['parent_id', 'code', 'account_code', 'sub_code', 'sub_name'];

    public function mainAccount(): BelongsTo
    {
        return $this->belongsTo(MainAccount::class, 'parent_id');
    }
}
