Content::sluggable()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 0
dl 0
loc 5
rs 10
c 0
b 0
f 0
1
<?php 
2
3
namespace Hideyo\Ecommerce\Framework\Services\Content\Entity;
4
5
use Hideyo\Ecommerce\Framework\Services\BaseModel;
6
use Cviebrock\EloquentSluggable\Sluggable;
7
8
class Content extends BaseModel
9
{
10
    use Sluggable;
11
12
    /**
13
     * The database table used by the model.
14
     *
15
     * @var string
16
     */
17
    protected $table = 'content';
18
19
    protected $sluggable = array(
20
        'build_from'        => 'title',
21
        'save_to'           => 'slug',
22
        'on_update'         => true,
23
    );
24
25
    // Add the 'avatar' attachment to the fillable array so that it's mass-assignable on this model.
26
    protected $fillable = ['id', 'active', 'content_group_id', 'title', 'content', 'meta_title', 'meta_description', 'meta_keywords', 'shop_id'];
27
28
    public function sluggable()
29
    {
30
        return [
31
            'slug' => [
32
                'source' => 'title'
33
            ]
34
        ];
35
    }
36
37
    public function contentGroup()
38
    {
39
        return $this->belongsTo('Hideyo\Ecommerce\Framework\Services\Content\Entity\ContentGroup');
40
    }
41
42
    public function contentImages()
43
    {
44
        return $this->hasMany('Hideyo\Ecommerce\Framework\Services\Content\Entity\ContentImage');
45
    }
46
}
47