<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Owing extends Model
{
    protected $fillable = [
        'tenant_id',
        'invoiceid',
        'regnum',
        'balance',
        'year',
    ];

    protected $casts = [
        'balance' => 'decimal:2',
    ];

    public function invoice()
    {
        return $this->belongsTo(Invoice::class, 'invoiceid');
    }

    public function tenant()
    {
        return $this->belongsTo(Tenant::class, 'tenant_id');
    }
}