Passed
Push — tailwind ( 8e1fcb...4c0702 )
by Fèvre
14:54
created

Category::boot()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 0
dl 0
loc 7
rs 10
c 0
b 0
f 0
1
<?php
2
namespace Xetaravel\Models;
3
4
use Xetaravel\Models\Presenters\CategoryPresenter;
5
6
class Category extends Model
7
{
8
    use CategoryPresenter;
0 ignored issues
show
Bug introduced by
The trait Xetaravel\Models\Presenters\CategoryPresenter requires the property $slug which is not provided by Xetaravel\Models\Category.
Loading history...
9
10
    /**
11
     * The attributes that are mass assignable.
12
     *
13
     * @var array
14
     */
15
    protected $fillable = [
16
        'title',
17
        'slug',
18
        'description'
19
    ];
20
21
    /**
22
     * The accessors to append to the model's array form.
23
     *
24
     * @var array
25
     */
26
    protected $appends = [
27
        'category_url'
28
    ];
29
30
    /**
31
     * Return the field to slug.
32
     *
33
     * @return string
34
     */
35
    public function slugStrategy(): string
36
    {
37
        return 'title';
38
    }
39
40
    /**
41
     * Get the articles for the category.
42
     *
43
     * @return \Illuminate\Database\Eloquent\Relations\HasMany
44
     */
45
    public function articles()
46
    {
47
        return $this->hasMany(Article::class);
48
    }
49
}
50