ArticleCategory   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 59
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getNameAttribute() 0 4 1
A store() 0 10 1
1
<?php
2
3
namespace App\Models;
4
5
/**
6
 * Class ArticleCategory.
7
 *
8
 * @property string name
9
 */
10
class ArticleCategory extends ChocolateyModel
11
{
12
    /**
13
     * Disable Timestamps.
14
     *
15
     * @var bool
16
     */
17
    public $timestamps = false;
18
19
    /**
20
     * Appenders Array.
21
     *
22
     * @var array
23
     */
24
    protected $appends = ['name'];
25
26
    /**
27
     * The table associated with the model.
28
     *
29
     * @var string
30
     */
31
    protected $table = 'chocolatey_articles_categories';
32
33
    /**
34
     * Primary Key of the Table.
35
     *
36
     * @var string
37
     */
38
    protected $primaryKey = 'link';
39
40
    /**
41
     * Get the Original Link Attribute.
42
     *
43
     * @return string
44
     */
45
    public function getNameAttribute()
46
    {
47
        return $this->attributes['link'];
48
    }
49
50
    /**
51
     * Store a New Article Category.
52
     *
53
     * @param string $link
54
     * @param string $translate
55
     *
56
     * @return $this
57
     */
58
    public function store(string $link, string $translate)
59
    {
60
        $this->attributes['link'] = $link;
61
        $this->attributes['translate'] = $translate;
62
        $this->timestamps = false;
63
64
        $this->save();
65
66
        return $this;
67
    }
68
}
69