UserBadge::getDescriptionAttribute()   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
c 0
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace App\Models;
4
5
use Sofa\Eloquence\Eloquence;
6
use Sofa\Eloquence\Mappable;
7
8
/**
9
 * Class UserBadge.
10
 */
11
class UserBadge extends ChocolateyModel
12
{
13
    use Eloquence, Mappable;
14
15
    /**
16
     * Disable Timestamps.
17
     *
18
     * @var bool
19
     */
20
    public $timestamps = false;
21
22
    /**
23
     * The table associated with the model.
24
     *
25
     * @var string
26
     */
27
    protected $table = 'users_badges';
28
29
    /**
30
     * Primary Key of the Table.
31
     *
32
     * @var string
33
     */
34
    protected $primaryKey = 'id';
35
36
    /**
37
     * The attributes that will be mapped.
38
     *
39
     * @var array
40
     */
41
    protected $maps = ['badgeIndex' => 'slot_id', 'code' => 'badge_code', 'name' => 'badge_code'];
42
43
    /**
44
     * The attributes excluded from the model's JSON form.
45
     *
46
     * @var array
47
     */
48
    protected $hidden = ['user_id', 'badge_code', 'slot_id', 'id'];
49
50
    /**
51
     * The Appender(s) of the Model.
52
     *
53
     * @var array
54
     */
55
    protected $appends = ['description', 'badgeIndex', 'code', 'name'];
56
57
    /**
58
     * Get Description Attribute.
59
     *
60
     * @return string
61
     */
62
    public function getDescriptionAttribute(): string
63
    {
64
        return "Badge {$this->attributes['badge_code']}";
65
    }
66
}
67