<?php

namespace Seka\Vzdelavanie\Models;

use Illuminate\Database\Eloquent\Model;

/**
 * Class Ucebnica
 * @package Seka\Vzdelavanie\Models
 */
class Ucebnica extends Model
{
    /**
     * @var string
     */
    protected $table = 'ucebnice';

    /**
     * @var array
     */
    protected $fillable = [
        'autor',
        'nazov',
        'popis',
        'verejne',
        'kategoria_id',
    ];

    /**
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
     */
    public function kategoria()
    {
        return $this->belongsTo(Kategoria::class, 'kategoria_id', 'id');
    }

    /**
     * @return \Illuminate\Database\Eloquent\Relations\HasMany
     */
    public function sekcie()
    {
        return $this->hasMany(Sekcia::class, 'ucebnica_id', 'id');
    }
}
