<?php

namespace App\Models;

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

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

    protected $fillable = [
        'title_ar',
        'title_en',
        'user_id',
        'photo',
    ];


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

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

}
