<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Swindon\FilamentHashids\Traits\HasHashid;

class CategoryNews extends Model
{
    use HasHashid;

    protected $guarded = ['id'];

    protected function casts(): array
    {
        return [
            'category_id' => 'integer',
            'news_id' => 'integer',
        ];
    }

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

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