This repository has been archived on 2026-09-27. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
tutoring/app/Models/Subject.php
T
2026-01-14 00:54:08 +00:00

20 lines
392 B
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Str;
class Subject extends Model
{
protected $fillable = ['name'];
protected static function booted()
{
static::creating(function ($subject) {
if (empty($subject->slug)) {
$subject->slug = Str::slug($subject->name);
}
});
}
}