SubCategory::category()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace App;
4
5
use App\Libraries\Presenterable\Presenterable;
6
use App\Libraries\Presenterable\Presenters\SubCategoryPresenter;
7
use App\Traits\ActivateableTrait;
8
use App\Traits\Categories\HasFilters;
9
use App\Traits\HasImages;
10
use Keyhunter\Administrator\Repository;
11
use Keyhunter\Translatable\HasTranslations;
12
use Keyhunter\Translatable\Translatable;
13
14
class SubCategory extends Repository implements Translatable
15
{
16
    use ActivateableTrait, HasTranslations, HasImages, HasFilters, Presenterable;
17
18
    /**
19
     * @var string
20
     */
21
    protected $table = 'sub_categories';
22
23
    /**
24
     * @var SubCategoryPresenter
25
     */
26
    public $presenter = SubCategoryPresenter::class;
27
28
    /**
29
     * @var array
30
     */
31
    protected $fillable = ['category_id', 'active'];
32
33
    /**
34
     * @var SubCategoryTranslations
35
     */
36
    public $translationModel = SubCategoryTranslations::class;
37
38
    /**
39
     * @var array
40
     */
41
    public $translatedAttributes = ['name', 'slug', 'seo_title', 'seo_description', 'seo_keywords'];
42
43
    /**
44
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
45
     */
46
    public function category()
47
    {
48
        return $this->belongsTo(Category::class, 'category_id', 'id');
49
    }
50
}
51