<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Support\Str;

class BlogCategory extends Model {
	use HasFactory, SoftDeletes;

	public $fillable = [
		'name',
		'slug',
	];

	protected static function boot() {
		parent::boot();

		static::creating(function ($model) {
			$model->slug = Str::slug($model->name);
		});
	}
}
