<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class LoanDuration extends Model
{
    protected $fillable = [
        'name',
        'duration_days',
        'apr',
        'is_active',
    ];

    protected $casts = [
        'duration_days' => 'integer',
        'apr' => 'decimal:6',
        'is_active' => 'boolean',
    ];

    public function loanApplications()
    {
        return $this->hasMany(LoanApplication::class, 'loan_duration_id');
    }
}
