Passed
Push — 5.0.0 ( 357374...f2ea1c )
by Fèvre
05:22
created

BlogCategory::slugStrategy()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

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