|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Laravel\Forge\Users; |
|
4
|
|
|
|
|
5
|
|
|
use Laravel\Forge\ApiResource; |
|
6
|
|
|
|
|
7
|
|
|
class User extends ApiResource |
|
8
|
|
|
{ |
|
9
|
|
|
/** |
|
10
|
|
|
* Resource type. |
|
11
|
|
|
* |
|
12
|
|
|
* @return string |
|
13
|
|
|
*/ |
|
14
|
|
|
public static function resourceType() |
|
15
|
|
|
{ |
|
16
|
|
|
return 'user'; |
|
17
|
|
|
} |
|
18
|
|
|
|
|
19
|
|
|
/** |
|
20
|
|
|
* Resource path (relative to owner or API root). |
|
21
|
|
|
* |
|
22
|
|
|
* @return string |
|
23
|
|
|
*/ |
|
24
|
|
|
public function resourcePath() |
|
25
|
|
|
{ |
|
26
|
|
|
return 'user'; |
|
27
|
|
|
} |
|
28
|
|
|
|
|
29
|
|
|
/** |
|
30
|
|
|
* Get user ID. |
|
31
|
|
|
* |
|
32
|
|
|
* @return int|null |
|
33
|
|
|
*/ |
|
34
|
|
|
public function getId() |
|
35
|
|
|
{ |
|
36
|
|
|
return $this->getData('id'); |
|
37
|
|
|
} |
|
38
|
|
|
|
|
39
|
|
|
/** |
|
40
|
|
|
* Get user name. |
|
41
|
|
|
* |
|
42
|
|
|
* @return string|null |
|
43
|
|
|
*/ |
|
44
|
|
|
public function getName() |
|
45
|
|
|
{ |
|
46
|
|
|
return $this->getData('name'); |
|
47
|
|
|
} |
|
48
|
|
|
|
|
49
|
|
|
/** |
|
50
|
|
|
* Get user email. |
|
51
|
|
|
* |
|
52
|
|
|
* @return string|null |
|
53
|
|
|
*/ |
|
54
|
|
|
public function getEmail() |
|
55
|
|
|
{ |
|
56
|
|
|
return $this->getData('email'); |
|
57
|
|
|
} |
|
58
|
|
|
|
|
59
|
|
|
/** |
|
60
|
|
|
* Get card's last four numbers. |
|
61
|
|
|
* |
|
62
|
|
|
* @return string|null |
|
63
|
|
|
*/ |
|
64
|
|
|
public function getCardLastFour() |
|
65
|
|
|
{ |
|
66
|
|
|
return $this->getData('card_last_four'); |
|
67
|
|
|
} |
|
68
|
|
|
|
|
69
|
|
|
/** |
|
70
|
|
|
* Determines whether the user is connected to GitHub. |
|
71
|
|
|
* |
|
72
|
|
|
* @return bool |
|
73
|
|
|
*/ |
|
74
|
|
|
public function connectedToGitHub(): bool |
|
75
|
|
|
{ |
|
76
|
|
|
return boolval($this->getData('connected_to_github')) === true; |
|
77
|
|
|
} |
|
78
|
|
|
|
|
79
|
|
|
/** |
|
80
|
|
|
* Determines whether the user is connected to GitLab. |
|
81
|
|
|
* |
|
82
|
|
|
* @return bool |
|
83
|
|
|
*/ |
|
84
|
|
|
public function connectedToGitLab(): bool |
|
85
|
|
|
{ |
|
86
|
|
|
return boolval($this->getData('connected_to_gitlab')) === true; |
|
87
|
|
|
} |
|
88
|
|
|
|
|
89
|
|
|
/** |
|
90
|
|
|
* Determines whether the user is connected to Bitbucket. |
|
91
|
|
|
* |
|
92
|
|
|
* @return bool |
|
93
|
|
|
*/ |
|
94
|
|
|
public function connectedToBitbucket(): bool |
|
95
|
|
|
{ |
|
96
|
|
|
return boolval($this->getData('connected_to_bitbucket')) === true; |
|
97
|
|
|
} |
|
98
|
|
|
|
|
99
|
|
|
/** |
|
100
|
|
|
* Determines whether the user is connected to Bitbucket V2. |
|
101
|
|
|
* |
|
102
|
|
|
* @return bool |
|
103
|
|
|
*/ |
|
104
|
|
|
public function connectedToBitbucketTwo(): bool |
|
105
|
|
|
{ |
|
106
|
|
|
return boolval($this->getData('connected_to_bitbucket_two')) === true; |
|
107
|
|
|
} |
|
108
|
|
|
|
|
109
|
|
|
/** |
|
110
|
|
|
* Determines whether the user is connected to DigitalOcean. |
|
111
|
|
|
* |
|
112
|
|
|
* @return bool |
|
113
|
|
|
*/ |
|
114
|
|
|
public function connectedToDigitalOcean(): bool |
|
115
|
|
|
{ |
|
116
|
|
|
return boolval($this->getData('connected_to_digitalocean')) === true; |
|
117
|
|
|
} |
|
118
|
|
|
|
|
119
|
|
|
/** |
|
120
|
|
|
* Determines whether the user is connected to Linode. |
|
121
|
|
|
* |
|
122
|
|
|
* @return bool |
|
123
|
|
|
*/ |
|
124
|
|
|
public function connectedToLinode(): bool |
|
125
|
|
|
{ |
|
126
|
|
|
return boolval($this->getData('connected_to_linode')) === true; |
|
127
|
|
|
} |
|
128
|
|
|
|
|
129
|
|
|
/** |
|
130
|
|
|
* Determines whether the user is connected to Vultr. |
|
131
|
|
|
* |
|
132
|
|
|
* @return bool |
|
133
|
|
|
*/ |
|
134
|
|
|
public function connectedToVultr(): bool |
|
135
|
|
|
{ |
|
136
|
|
|
return boolval($this->getData('connected_to_vultr')) === true; |
|
137
|
|
|
} |
|
138
|
|
|
|
|
139
|
|
|
/** |
|
140
|
|
|
* Determines whether the user is connected to Aws. |
|
141
|
|
|
* |
|
142
|
|
|
* @return bool |
|
143
|
|
|
*/ |
|
144
|
|
|
public function connectedToAws(): bool |
|
145
|
|
|
{ |
|
146
|
|
|
return boolval($this->getData('connected_to_aws')) === true; |
|
147
|
|
|
} |
|
148
|
|
|
|
|
149
|
|
|
/** |
|
150
|
|
|
* Determines whether the user has active Forge subscription. |
|
151
|
|
|
* |
|
152
|
|
|
* @return bool |
|
153
|
|
|
*/ |
|
154
|
|
|
public function subscribed(): bool |
|
155
|
|
|
{ |
|
156
|
|
|
return boolval($this->getData('subscribed')) === true; |
|
157
|
|
|
} |
|
158
|
|
|
|
|
159
|
|
|
/** |
|
160
|
|
|
* Determines whether the user can create new servers. |
|
161
|
|
|
* |
|
162
|
|
|
* @return bool |
|
163
|
|
|
*/ |
|
164
|
|
|
public function canCreateServers(): bool |
|
165
|
|
|
{ |
|
166
|
|
|
return boolval($this->getData('can_create_servers')) === true; |
|
167
|
|
|
} |
|
168
|
|
|
} |
|
169
|
|
|
|