<?php

namespace App\Models;

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

class JudicialPrecedent extends Model
{
    use HasFactory;

    protected $fillable = [
        'ruling_number',
        'ruling_date',
        'subject',
        'full_text',
        'issuing_authority',
        'category_id'
    ];

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

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

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