Total Complexity | 12 |
Total Lines | 61 |
Duplicated Lines | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
10 | class Message extends Model |
||
11 | { |
||
12 | protected $appends = [ |
||
13 | "id", |
||
14 | 'autoHide', |
||
15 | 'framework', |
||
16 | 'message', |
||
17 | 'level', |
||
18 | 'title', |
||
19 | 'type', |
||
20 | ]; |
||
21 | protected $casts = [ |
||
22 | 'autoHide' => 'boolean', |
||
23 | ]; |
||
24 | protected $fillable = [ |
||
25 | "id", |
||
26 | 'autoHide', |
||
27 | 'framework', |
||
28 | 'message', |
||
29 | 'level', |
||
30 | 'title', |
||
31 | 'type', |
||
32 | ]; |
||
33 | |||
34 | public function getIdAttribute(): string |
||
35 | { |
||
36 | $this->attributes["id"] = $this->attributes["id"] |
||
37 | ?? Str::random(16); |
||
38 | |||
39 | return $this->attributes["id"]; |
||
40 | } |
||
41 | |||
42 | public function getAutoHideAttribute(): bool |
||
43 | { |
||
44 | return ($this->attributes['autoHide'] === true); |
||
45 | } |
||
46 | |||
47 | public function getFrameworkAttribute(): string |
||
51 | } |
||
52 | |||
53 | public function getMessageAttribute(): string |
||
54 | { |
||
55 | return $this->attributes['message'] ?: ''; |
||
56 | } |
||
57 | |||
58 | public function getLevelAttribute(): string |
||
59 | { |
||
60 | return $this->attributes['level'] ?: 'info'; |
||
61 | } |
||
62 | |||
63 | public function getTitleAttribute(): string |
||
64 | { |
||
65 | return $this->attributes['title'] ?: ''; |
||
66 | } |
||
67 | |||
68 | public function getTypeAttribute(): string |
||
71 | } |
||
72 | } |
||
73 |