<?php

namespace App;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use App\Scopes\MessageScope;

class AvanseFinSummary extends Model
{

    protected $table = 'avanse_fin_summary';

    protected $fillable = [
        'finance_id' ,'effectiveRateOfReturn','totalGracePft','totalGraceCpz','totalGrossGrcPft','totalCpz','totalProfit','totalRepayAmt','feeChargeAmount','numberOfTerms','loanTenor','maturityDate','firstEmiAmount','nextSchDate','nextRepayAmount','futureInst','futureTenor','firstInstDate','paidTotal','paidPri','paidPft','lastRepayDate','outstandingTotal','outstandingPri','outstandingPft','overdueTotal','overduePri','overduePft','overdueInst','overdueCharges','advPaymentAmount','finActiveStatus','fullyDisb', 'created_at'
    ];

    public function save(array $options = array())
    {
        $missingKeys = array_diff(array_values($this->fillable), array_keys($this->getAttributes()));
        foreach ($missingKeys as $missingKey){
            $this->$missingKey = '';
        }
        parent::save($options);
    }
}
