<?php

namespace App;

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

class PreEligibilityApplication extends Model
{
    use SoftDeletes;

    protected $table = 'pre_eligibility_applications';

    protected $fillable = [
        'tenure',
        'monthly_income',
        'loan_amount',
        'electricity_bill_amount',
        'result',
        'customer_name',
        'mobile_number',
        'city',
        'merchant_id',
        'offer_id',
    ];

    public function creditReport()
    {
        return $this->hasMany('App\PreEligibilityCreditReport', 'application_id', 'id');
    }

    public function foir()
    {
        return $this->hasMany('App\PreEligibilityFoir', 'application_id', 'id');
    }

    public function merchant()
    {
        return $this->belongsTo('App\Merchant', 'merchant_id', 'id');
    }

    public function activeOffer()
    {
        return $this->hasOne('App\MerchantOffers', 'id', 'offer_id');
    }
}
