1 | <?php |
||
41 | class User extends Model implements AuthenticatableContract, AuthorizableContract, CanResetPasswordContract |
||
42 | { |
||
43 | use Authenticatable, Authorizable, CanResetPassword, Notifiable; |
||
44 | |||
45 | /** |
||
46 | * The rules for user passwords. |
||
47 | * |
||
48 | * @var string |
||
49 | */ |
||
50 | const PASSWORD_RULES = 'regex:((?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,})'; |
||
51 | |||
52 | /** |
||
53 | * The regex rules for usernames. |
||
54 | * |
||
55 | * @var string |
||
56 | */ |
||
57 | const USERNAME_RULES = 'regex:/^([\w\d\.\-]{1,255})$/'; |
||
58 | |||
59 | /** |
||
60 | * The table associated with the model. |
||
61 | * |
||
62 | * @var string |
||
63 | */ |
||
64 | protected $table = 'users'; |
||
65 | |||
66 | /** |
||
67 | * A list of mass-assignable variables. |
||
68 | * |
||
69 | * @var [type] |
||
70 | */ |
||
71 | protected $fillable = ['username', 'email', 'name_first', 'name_last', 'password', 'language', 'use_totp', 'totp_secret', 'gravatar', 'root_admin']; |
||
72 | |||
73 | /** |
||
74 | * Cast values to correct type. |
||
75 | * |
||
76 | * @var array |
||
77 | */ |
||
78 | protected $casts = [ |
||
79 | 'root_admin' => 'integer', |
||
80 | 'use_totp' => 'integer', |
||
81 | 'gravatar' => 'integer', |
||
82 | ]; |
||
83 | |||
84 | /** |
||
85 | * The attributes excluded from the model's JSON form. |
||
86 | * |
||
87 | * @var array |
||
88 | */ |
||
89 | protected $hidden = ['password', 'remember_token', 'totp_secret']; |
||
90 | |||
91 | /** |
||
92 | * Determines if a user has permissions. |
||
93 | * |
||
94 | * @return bool |
||
95 | */ |
||
96 | public function permissions() |
||
100 | |||
101 | /** |
||
102 | * Enables or disables TOTP on an account if the token is valid. |
||
103 | * |
||
104 | * @param int $token The token that we want to verify. |
||
105 | * @return bool |
||
106 | */ |
||
107 | public function toggleTotp($token) |
||
118 | |||
119 | /** |
||
120 | * Set a user password to a new value assuming it meets the following requirements: |
||
121 | * - 8 or more characters in length |
||
122 | * - at least one uppercase character |
||
123 | * - at least one lowercase character |
||
124 | * - at least one number. |
||
125 | * |
||
126 | * @param string $password The raw password to set the account password to. |
||
127 | * @param string $regex The regex to use when validating the password. Defaults to '((?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,})'. |
||
128 | * @return void |
||
129 | */ |
||
130 | public function setPassword($password, $regex = '((?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,})') |
||
139 | |||
140 | /** |
||
141 | * Send the password reset notification. |
||
142 | * |
||
143 | * @param string $token |
||
144 | * @return void |
||
145 | */ |
||
146 | public function sendPasswordResetNotification($token) |
||
150 | |||
151 | /** |
||
152 | * Return true or false depending on wether the user is root admin or not. |
||
153 | * |
||
154 | * @return bool the user is root admin |
||
155 | */ |
||
156 | public function isRootAdmin() |
||
160 | |||
161 | /** |
||
162 | * Returns the user's daemon secret for a given server. |
||
163 | * @param Server $server \Pterodactyl\Models\Server |
||
164 | * @return null|string |
||
165 | */ |
||
166 | public function daemonToken(Server $server) |
||
180 | } |
||
181 |
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.