<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class ChequeBook extends Model {
    // protected $guarded=['cheque_book_id'];
    // protected $primaryKey = 'cheque_book_id';
    // protected $casts=['received_date'=>'date','closed_at'=>'datetime'];
    // public function bankAccount(){return $this->belongsTo(BankAccount::class);}
    // public function bank(){return $this->belongsTo(Bank::class);}
    // public function organize(){return $this->belongsTo(OrgMaster::class);}
    // public function status(){return $this->belongsTo(ActionMaster::class);}
    // // public function leaves(){return $this->hasMany(ChequeLeaf::class);}


     protected $table = 'cheque_books';

    protected $primaryKey = 'cheque_book_id';

    protected $guarded = ['cheque_book_id'];

    protected $casts = [
        'received_date' => 'date',
        'closed_at' => 'datetime'
    ];

    public function bookAccount()
    {
        return $this->belongsTo(
            LedgerMaster::class,
            'Lg_Id',
            'Lg_Id'
        );
    }

   public function bank()
{
    return $this->belongsTo(Bank::class, 'Bank_Id', 'Bank_Id');
}

    public function organize()
    {
        return $this->belongsTo(
            OrgMaster::class,
            'Org_Id',
            'Org_Id'
        );
    }

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

public function ChequeFormate()
{
    return $this->belongsTo(ChequeFormat::class, 'cheque_format_id', 'cheque_format_id');
}
}
