<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Expense extends Model
{
    protected $fillable = [
        'user_id', 'cash_session_id', 'amount', 'category', 'description', 'expense_date'
    ];

    protected $casts = [
        'expense_date' => 'datetime',
    ];

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

    public function session()
    {
        return $this->belongsTo(CashSession::class, 'cash_session_id');
    }
}
