<?php

namespace App\Models;

use Cviebrock\EloquentSluggable\Sluggable;
use Cviebrock\EloquentSluggable\SluggableScopeHelpers;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class Video extends Model
{
    use HasFactory;
    use Sluggable;
    use SluggableScopeHelpers;

    protected $fillable = ['link'];

    public function keywords()
    {
        return $this->morphMany(KeyWord::class, 'keywordable');
    }

    public function sluggable(): array
    {
        return [
            'slug' => [
                'source' => 'link',
                'onUpdate' => true,
            ]
        ];
    }
}
