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 | * Determines if a user has permissions. |
||
92 | * |
||
93 | * @return bool |
||
94 | */ |
||
95 | public function permissions() |
||
99 | |||
100 | /** |
||
101 | * Enables or disables TOTP on an account if the token is valid. |
||
102 | * |
||
103 | * @param int $token The token that we want to verify. |
||
104 | * @return bool |
||
105 | */ |
||
106 | public function toggleTotp($token) |
||
117 | |||
118 | /** |
||
119 | * Set a user password to a new value assuming it meets the following requirements: |
||
120 | * - 8 or more characters in length |
||
121 | * - at least one uppercase character |
||
122 | * - at least one lowercase character |
||
123 | * - at least one number. |
||
124 | * |
||
125 | * @param string $password The raw password to set the account password to. |
||
126 | * @param string $regex The regex to use when validating the password. Defaults to '((?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,})'. |
||
127 | * @return void |
||
128 | */ |
||
129 | public function setPassword($password, $regex = '((?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,})') |
||
138 | |||
139 | /** |
||
140 | * Send the password reset notification. |
||
141 | * |
||
142 | * @param string $token |
||
143 | * @return void |
||
144 | */ |
||
145 | public function sendPasswordResetNotification($token) |
||
149 | |||
150 | /** |
||
151 | * Return true or false depending on wether the user is root admin or not. |
||
152 | * |
||
153 | * @return bool the user is root admin |
||
154 | */ |
||
155 | public function isRootAdmin() |
||
159 | |||
160 | /** |
||
161 | * Returns the user's daemon secret for a given server. |
||
162 | * @param Server $server \Pterodactyl\Models\Server |
||
163 | * @return null|string |
||
164 | */ |
||
165 | public function daemonToken(Server $server) |
||
179 | } |
||
180 |
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.