Total Complexity | 4 |
Total Lines | 43 |
Duplicated Lines | 0 % |
Coverage | 27.27% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
22 | trait Attribute |
||
23 | { |
||
24 | /** |
||
25 | * Set "password" attribute value. |
||
26 | * |
||
27 | * @param mixed $value |
||
28 | * @return void |
||
29 | 51 | */ |
|
30 | public function setPasswordAttribute($value) |
||
31 | 51 | { |
|
32 | $this->attributes['password'] = Hash::make($value); |
||
|
|||
33 | 51 | ||
34 | return $this; |
||
35 | } |
||
36 | |||
37 | /** |
||
38 | * Return "is_active_badge" attribute value. |
||
39 | * |
||
40 | * @return string |
||
41 | */ |
||
42 | public function getIsActiveBadgeAttribute(): string |
||
43 | { |
||
44 | if ($this->is_active) { |
||
45 | return sprintf(<<<'html' |
||
46 | <div class="badge badge-success">%s</div> |
||
47 | html, trans('Active')); |
||
48 | } |
||
49 | |||
50 | return sprintf(<<<'html' |
||
51 | <div class="badge badge-danger">%s</div> |
||
52 | html, trans('Not Active')); |
||
53 | } |
||
54 | |||
55 | /** |
||
56 | * Return "role" attribute value. |
||
57 | * |
||
58 | * @return string |
||
59 | */ |
||
60 | public function getRoleAttribute(): string |
||
65 | } |
||
66 | } |
||
67 |