<?php

declare(strict_types=1);

namespace Seka\Vzdelavanie\Models\Pouzivatel\Kniznica;

use Core\Http\Traits\Hashidable;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\MorphTo;
use Illuminate\Database\Eloquent\Relations\BelongsTo;

/**
 * Class Oblubene
 *
 * @package Seka\Vzdelavanie\Models\Pouzivatel\Kniznica
 */
final class Oblubene extends Model
{
    use Hashidable;

    /**
     * @var string
     */
    protected $table = 'vzdelavanie_pouzivatel_kniznica_oblubene';

    /**
     * @var string[]
     */
    protected $appends = [
        'hash_id',
    ];

    /**
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
     */
    public function pouzivatel(): BelongsTo
    {
        return $this->belongsTo('\App\Models\Pouzivatel\Pouzivatel', 'pouzivatel_id', 'id');
    }

    /**
     * @return \Illuminate\Database\Eloquent\Relations\MorphTo
     */
    public function oblubene(): MorphTo
    {
        return $this->morphTo();
    }
}
