<?php

namespace App\Models;

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

class Besteding extends Model
{
    protected $table = 'bestedingen';

    protected $fillable = [
        'budget_id',
        'bedrag',
        'beschrijving',
        'datum',
        'categorie',
    ];

    protected function casts(): array
    {
        return [
            'bedrag' => 'decimal:2',
            'datum'  => 'date',
        ];
    }

    public function budget(): BelongsTo
    {
        return $this->belongsTo(Budget::class);
    }
}
