Country::store()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 5
nc 1
nop 2
1
<?php
2
3
namespace App\Models;
4
5
/**
6
 * Class Country.
7
 *
8
 * @property mixed countryCode
9
 * @property mixed uniqueId
10
 */
11
class Country extends ChocolateyModel
12
{
13
    /**
14
     * Disable Timestamps.
15
     *
16
     * @var bool
17
     */
18
    public $timestamps = false;
19
20
    /**
21
     * The table associated with the model.
22
     *
23
     * @var string
24
     */
25
    protected $table = 'chocolatey_shop_countries';
26
27
    /**
28
     * The Appender(s) of the Model.
29
     *
30
     * @var array
31
     */
32
    protected $appends = ['uniqueId'];
33
34
    /**
35
     * Primary Key of the Table.
36
     *
37
     * @var string
38
     */
39
    protected $primaryKey = 'id';
40
41
    /**
42
     * Store an Shop Country.
43
     *
44
     * @param string $countryCode
45
     * @param string $name
46
     *
47
     * @return Country
48
     */
49
    public function store(string $countryCode, string $name): Country
50
    {
51
        $this->attributes['countryCode'] = $countryCode;
52
        $this->attributes['name'] = $name;
53
        $this->timestamps = false;
54
55
        return $this;
56
    }
57
58
    /**
59
     * Get Unique Id.
60
     *
61
     * @return int
62
     */
63
    public function getUniqueIdAttribute(): int
64
    {
65
        return $this->attributes['id'];
66
    }
67
}
68