<?php

namespace App\Models;

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

class ArtigoAnexo extends Model
{
    use HasFactory;

    protected $table = 'artigo_anexos';

    protected $fillable = [
        'artigo_id',
        'user_id',
        'nome_original',
        'caminho',
        'tipo',
        'mime',
        'tamanho',
    ];

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

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