<?php


namespace App\Models\Traits\Bootables;


use App\Models\Traits\HasSlug;
use Illuminate\Database\Eloquent\Model;

trait Sluglable{
    use HasSlug;

    public static function bootSluglable(){
        static::created(function (Model $model) {
            $model->slugify();
        });

        static::updated(function (Model $model) {
            $model->slugify();
        });

//        static::deleted(function (Model $model) {
//            $model->unslugify();
//        });
    }

}
