<?php

namespace App;

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

class EmiPaymentTemp extends Model
{

    protected $table = 'emi_payments_temp';

    public function transaction()
    {
        return $this->hasMany('App\PaymentTransactionTemp','emi_payment_id','id')->whereNull('is_deleted_at')->orderBy('emi_payment_id');
    }

    public function application(){

        return $this->hasOne('App\ConsumerApplication','id','application_id')->whereNull('is_deleted');
    }

    public function moratoriums(){
        return $this->hasMany('App\Moratorium','application_id','application_id')->where('status',1);
    }

    public function application_element(){
        $application_element = $this->hasOne('App\ConsumerApplicationElement','application_id','application_id');
        return $application_element;
    }
}
