<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

class TndEMDTrans extends Model
{
    use SoftDeletes;

    protected $table = 'tndemd_trans';
    protected $primaryKey = 'TET_Id';

    protected $fillable = [
        'TE_Date',
        'TES_Date',
        'TEE_Date',
        'For_Acc',
        'TER_Date',
        'SL_Id',
        'TE_Id',
        'EMD_Amt',
        'TET_HOD',
        'TET_HDT',
        'TET_CD',
        'TET_BillNo',
        'Status',
        'Remarks'
    ];

    protected $dates = ['deleted_at'];

    // Relations

    public function subledger()
    {
        return $this->belongsTo(SubLedgerMaster::class, 'SL_Id', 'SL_Id');
    }

    public function tender()
    {
        return $this->belongsTo(TenderEntry::class, 'TE_Id', 'TE_Id');
    }

    public function hod()
    {
        return $this->belongsTo(UserMaster::class, 'TET_HOD', 'Usr_Id');
    }

    public function statusAction()
    {
        return $this->belongsTo(ActionMaster::class, 'Status', 'Act_Id');
    }
}
