<?php

namespace App\Models;

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

class KennisArtikel extends Model
{
    use SoftDeletes;

    protected $table = 'kennis_artikelen';

    protected $fillable = [
        'titel',
        'inhoud',
        'auteur_id',
    ];

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

    public function tags(): BelongsToMany
    {
        return $this->belongsToMany(Tag::class, 'kennis_artikel_tag');
    }
}
