Category   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
lcom 0
cbo 2
dl 0
loc 14
rs 10
c 1
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A posts() 0 4 1
A getUrlAttribute() 0 4 1
1
<?php
2
3
namespace App\Models;
4
5
use App\Traits\Sluggable;
6
use Illuminate\Database\Eloquent\Model;
7
8
class Category extends Model
9
{
10
    use Sluggable;
11
12
    public function posts()
13
    {
14
        return $this->hasMany(Post::class);
15
    }
16
17
    public function getUrlAttribute()
18
    {
19
        return route('categories.show', $this->slug);
20
    }
21
}
22