1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace App\Models; |
4
|
|
|
|
5
|
|
|
use Sofa\Eloquence\Eloquence; |
6
|
|
|
use Sofa\Eloquence\Mappable; |
7
|
|
|
|
8
|
|
|
/** |
9
|
|
|
* Class UserGroup. |
10
|
|
|
*/ |
11
|
|
|
class UserGroup 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 = 'guilds'; |
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 = ['badgeCode' => 'badge', 'roomId' => 'room_id', 'primaryColour' => 'color_one', 'secondaryColour' => 'color_two']; |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* The attributes excluded from the model's JSON form. |
45
|
|
|
* |
46
|
|
|
* @var array |
47
|
|
|
*/ |
48
|
|
|
protected $hidden = ['user_id', 'badge', 'slot_id', 'id', 'user_id', 'room_id', 'state', 'rights', 'forum', 'date_created', 'read_forum', 'post_messages', 'post_threads', 'mod_forum']; |
49
|
|
|
|
50
|
|
|
/** |
51
|
|
|
* The Appender(s) of the Model. |
52
|
|
|
* |
53
|
|
|
* @var array |
54
|
|
|
*/ |
55
|
|
|
protected $appends = ['badgeCode', 'roomId', 'primaryColour', 'secondaryColour', 'type', 'isAdmin']; |
56
|
|
|
|
57
|
|
|
/** |
58
|
|
|
* Return if is Admin. |
59
|
|
|
* |
60
|
|
|
* @TODO: Link with User Data |
61
|
|
|
* |
62
|
|
|
* @return bool |
63
|
|
|
*/ |
64
|
|
|
public function getIsAdminAttribute(): bool |
65
|
|
|
{ |
66
|
|
|
return false; |
67
|
|
|
} |
68
|
|
|
|
69
|
|
|
/** |
70
|
|
|
* Get the Group Type. |
71
|
|
|
* |
72
|
|
|
* @TODO: What NORMAL means? |
73
|
|
|
* |
74
|
|
|
* @return string |
75
|
|
|
*/ |
76
|
|
|
public function getTypeAttribute(): string |
77
|
|
|
{ |
78
|
|
|
return 'NORMAL'; |
79
|
|
|
} |
80
|
|
|
} |
81
|
|
|
|