1 | <?php |
||
40 | class User extends Model implements AuthenticatableContract, AuthorizableContract, CanResetPasswordContract |
||
41 | { |
||
42 | use Authenticatable, Authorizable, CanResetPassword, Notifiable; |
||
43 | |||
44 | /** |
||
45 | * The rules for user passwords. |
||
46 | * |
||
47 | * @var string |
||
48 | */ |
||
49 | const PASSWORD_RULES = 'regex:((?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,})'; |
||
50 | |||
51 | /** |
||
52 | * The regex rules for usernames. |
||
53 | * |
||
54 | * @var string |
||
55 | */ |
||
56 | const USERNAME_RULES = 'regex:/^([\w\d\.\-]{1,255})$/'; |
||
57 | |||
58 | /** |
||
59 | * The table associated with the model. |
||
60 | * |
||
61 | * @var string |
||
62 | */ |
||
63 | protected $table = 'users'; |
||
64 | |||
65 | /** |
||
66 | * A list of mass-assignable variables. |
||
67 | * |
||
68 | * @var [type] |
||
69 | */ |
||
70 | protected $fillable = ['username', 'email', 'name_first', 'name_last', 'password', 'language', 'use_totp', 'totp_secret', 'gravatar', 'root_admin']; |
||
71 | |||
72 | /** |
||
73 | * Cast values to correct type. |
||
74 | * |
||
75 | * @var array |
||
76 | */ |
||
77 | protected $casts = [ |
||
78 | 'root_admin' => 'integer', |
||
79 | 'use_totp' => 'integer', |
||
80 | 'gravatar' => 'integer', |
||
81 | ]; |
||
82 | |||
83 | /** |
||
84 | * The attributes excluded from the model's JSON form. |
||
85 | * |
||
86 | * @var array |
||
87 | */ |
||
88 | protected $hidden = ['password', 'remember_token', 'totp_secret']; |
||
89 | |||
90 | /** |
||
91 | * Enables or disables TOTP on an account if the token is valid. |
||
92 | * |
||
93 | * @param int $token The token that we want to verify. |
||
94 | * @return bool |
||
95 | */ |
||
96 | public function toggleTotp($token) |
||
107 | |||
108 | /** |
||
109 | * Set a user password to a new value assuming it meets the following requirements: |
||
110 | * - 8 or more characters in length |
||
111 | * - at least one uppercase character |
||
112 | * - at least one lowercase character |
||
113 | * - at least one number. |
||
114 | * |
||
115 | * @param string $password The raw password to set the account password to. |
||
116 | * @param string $regex The regex to use when validating the password. Defaults to '((?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,})'. |
||
117 | * @return void |
||
118 | */ |
||
119 | public function setPassword($password, $regex = '((?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,})') |
||
128 | |||
129 | /** |
||
130 | * Send the password reset notification. |
||
131 | * |
||
132 | * @param string $token |
||
133 | * @return void |
||
134 | */ |
||
135 | public function sendPasswordResetNotification($token) |
||
139 | |||
140 | /** |
||
141 | * Return true or false depending on wether the user is root admin or not. |
||
142 | * |
||
143 | * @return bool the user is root admin |
||
144 | */ |
||
145 | public function isRootAdmin() |
||
149 | |||
150 | /** |
||
151 | * Returns the user's daemon secret for a given server. |
||
152 | * @param Server $server \Pterodactyl\Models\Server |
||
153 | * @return null|string |
||
154 | */ |
||
155 | public function daemonToken(Server $server) |
||
169 | |||
170 | /** |
||
171 | * Returns an array of all servers a user is able to access. |
||
172 | * Note: does not account for user admin status. |
||
173 | * |
||
174 | * @return array |
||
175 | */ |
||
176 | public function serverAccessArray() |
||
182 | |||
183 | /** |
||
184 | * Returns an array of all servers a user is able to access. |
||
185 | * Note: does not account for user admin status. |
||
186 | * |
||
187 | * @return Collection |
||
188 | */ |
||
189 | public function serverAccessCollection($paginate = null) |
||
198 | |||
199 | /** |
||
200 | * Returns all permissions that a user has. |
||
201 | * |
||
202 | * @return \Illuminate\Database\Eloquent\Relations\HasManyThrough |
||
203 | */ |
||
204 | public function permissions() |
||
208 | |||
209 | /** |
||
210 | * Returns all servers that a user owns. |
||
211 | * |
||
212 | * @return \Illuminate\Database\Eloquent\Relations\HasMany |
||
213 | */ |
||
214 | public function servers() |
||
218 | } |
||
219 |
Since your code implements the magic getter
_get
, this function will be called for any read access on an undefined variable. You can add the@property
annotation to your class or interface to document the existence of this variable.If the property has read access only, you can use the @property-read annotation instead.
Of course, you may also just have mistyped another name, in which case you should fix the error.
See also the PhpDoc documentation for @property.