<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;

class LoanStatusHistory extends Model
{
    protected $fillable = ['loan_id','from_status','to_status','notes','changed_by','changed_at'];

    protected function casts(): array { return ['changed_at'=>'datetime']; }

    public function loan(): BelongsTo { return $this->belongsTo(Loan::class); }
    public function changer(): BelongsTo { return $this->belongsTo(User::class, 'changed_by'); }
}
