for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Str;
class ForumCategory extends Model
{
use HasFactory;
protected $fillable = ['name', 'slug'];
protected $dates = ['created_at', 'updated_at'];
protected static function boot()
parent::boot();
static::creating(function ($category) {
$category->slug = Str::slug($category->name);
});
}