<?php

namespace App\Models;

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

class History extends Model
{
    use HasFactory;

    protected $guarded = [];

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

    public function addiction()
    {
        return $this->belongsTo(Addiction::class, 'addiction_id', 'id');
    }

    public function details()
    {
        return $this->hasMany(HistoryDetail::class, 'history_id', 'id');
    }
}
