ForumCategory   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
dl 0
loc 13
rs 10
c 1
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A boot() 0 6 1
1
<?php
2
3
namespace App\Models;
4
5
use Illuminate\Database\Eloquent\Factories\HasFactory;
6
use Illuminate\Database\Eloquent\Model;
7
use Str;
8
9
class ForumCategory extends Model
10
{
11
    use HasFactory;
12
13
    protected $fillable = ['name', 'slug'];
14
    protected $dates = ['created_at', 'updated_at'];
15
16
    protected static function boot()
17
    {
18
        parent::boot();
19
20
        static::creating(function ($category) {
21
            $category->slug = Str::slug($category->name);
22
        });
23
    }
24
}
25