<?php

namespace App\Models;

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

class TimelineUpdate extends Model
{
    use HasFactory;

    protected $fillable = [
        'timeline_id',
        'admin_id',
        'update_text',
    ];

    /**
     * Get the timeline that owns the update.
     */
    public function timeline(): BelongsTo
    {
        return $this->belongsTo(Timeline::class);
    }

    /**
     * Get the admin that created the update.
     */
    public function admin(): BelongsTo
    {
        return $this->belongsTo(User::class, 'admin_id');
    }
}
