<?php
 
namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Loan extends Model
{
    protected $fillable = [
        'user_id',
        'amount',
        'tenure_months',
        'purpose',
        'interest_rate',
        'total_payable',
        'monthly_installment',
        'status',
        'nid_front_path',
        'nid_back_path',
    ];

    public function user()
    {
        return $this->belongsTo(User::class);
    }

    public function installments()
    {
        return $this->hasMany(LoanInstallment::class);
    }

    public function deposits()
    {
        return $this->hasMany(LoanDeposit::class);
    }
}
