<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

class BankAccount extends Model {
    // protected $guarded=['bank_account_id'];
    // protected $casts=['is_active'=>'boolean','opening_balance'=>'float','od_limit'=>'float'];
    // public function bank(){return $this->belongsTo(Bank::class);}
    // public function organize(){return $this->belongsTo(OrgMaster::class);}
    // public function chequeBooks(){return $this->hasMany(ChequeBook::class);}
    // // public function chequeLeaves(){return $this->hasMany(ChequeLeaf::class);}
    // public function cheques(){return $this->hasMany(Cheque::class);}

    use SoftDeletes;

  protected $table = 'bank_accounts';

    protected $primaryKey = 'bank_account_id';

    public $incrementing = true;

    protected $keyType = 'int';

    protected $guarded = ['bank_account_id'];

    protected $casts = [
        'is_active' => 'boolean',
        'opening_balance' => 'float',
        'od_limit' => 'float'
    ];

    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 chequeBooks()
    {
        return $this->hasMany(ChequeBook::class, 'cheque_book_id', 'cheque_book_id');
    }

    public function cheques()
    {
        return $this->hasMany(Cheque::class, 'cheque_id', 'cheque_id');
    }
}









