<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class LeaveRequest extends Model
{
    protected $fillable = ['user_id', 'leave_type_id', 'start_date', 'end_date', 'total_days', 'reason', 'status', 'admin_comment', 'document_path', 'reviewed_by', 'reviewed_at'];
    protected function casts(): array { return ['start_date' => 'date', 'end_date' => 'date', 'reviewed_at' => 'datetime']; }
    public function user(){ return $this->belongsTo(User::class); }
    public function leaveType(){ return $this->belongsTo(LeaveType::class); }
    public function reviewer(){ return $this->belongsTo(User::class, 'reviewed_by'); }
}
