Completed
Push — development ( 2fad51...a387f8 )
by Claudio
02:44
created

ShopCategory   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 55
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A store() 0 6 1
A getCategoryAttribute() 0 4 1
1
<?php
2
3
namespace App\Models;
4
5
/**
6
 * Class ShopCategory
7
 * @package App\Models
8
 */
9
class ShopCategory extends ChocolateyModel
10
{
11
    /**
12
     * Disable Timestamps
13
     *
14
     * @var bool
15
     */
16
    public $timestamps = false;
17
18
    /**
19
     * The table associated with the model.
20
     *
21
     * @var string
22
     */
23
    protected $table = 'chocolatey_shop_items_categories';
24
25
    /**
26
     * Primary Key of the Table
27
     *
28
     * @var string
29
     */
30
    protected $primaryKey = 'category_name';
31
32
    /**
33
     * The Appender(s) of the Model
34
     *
35
     * @var array
36
     */
37
    protected $appends = [
38
        'category',
39
    ];
40
41
    /**
42
     * Store an Shop Country
43
     *
44
     * @param string $categoryName
45
     * @return ShopCategory
46
     */
47
    public function store(string $categoryName): ShopCategory
48
    {
49
        $this->attributes['category_name'] = $categoryName;
50
51
        return $this;
52
    }
53
54
    /**
55
     * Get Shop Category Name
56
     *
57
     * @return string
58
     */
59
    public function getCategoryAttribute(): string
60
    {
61
        return $this->attributes['category_name'];
62
    }
63
}
64