<?php

namespace App\Models;

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

class LegalOpinion extends Model
{
    use HasFactory;

    protected $fillable = [
        'opinion_number',
        'opinion_date',
        'subject',
        'full_text',
        'issuing_authority',
        'category_id',
    ];

    protected $hidden = ['created_at', 'updated_at'];

    public function arts()
    {
        return $this->belongsToMany(Art::class, 'art_legal_opinion');
    }

    public function category()
    {
        return $this->belongsTo(LegalOpinionCategory::class, 'category_id');
    }
}
