<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class Caution extends Model
{
    use HasFactory;

    protected $fillable = [
        'reference',
        'market_name',
        'amount',
        'method',
        'check_id',
        'submission_date',
        'expiry_date',
        'notification_date',
        'status',
        'notes',
        'user_id'
    ];

    protected $casts = [
        'submission_date' => 'date',
        'expiry_date' => 'date',
        'notification_date' => 'date',
        'amount' => 'decimal:2'
    ];

    public function check()
    {
        return $this->belongsTo(Check::class);
    }

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