<?php

namespace App\Models;

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

class ArtigoVisualizacao extends Model
{
    public $timestamps = false;

    protected $table = 'artigo_visualizacoes';

    protected $fillable = [
        'artigo_id',
        'user_id',
        'ip',
        'user_agent',
        'created_at',
    ];

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

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

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