<?php

namespace App\Models;

use Spatie\Sluggable\HasSlug;
use Spatie\Sluggable\SlugOptions;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

class Supliers extends Model
{
    use HasFactory,SoftDeletes;
     use HasSlug;

    protected $table = 'supliers';
    protected $primaryKey = 'id';

    public function getSlugOptions() : SlugOptions
    {
        return SlugOptions::create()
            ->generateSlugsFrom('suplier_name')
            ->saveSlugsTo('slug');
    }
    
    public function grn()
    {
        return $this->belongsTo(GRNS::class, 'suplier');
    }
}
