1 | <?php |
||
38 | class User extends Model implements AuthenticatableContract, CanResetPasswordContract |
||
39 | { |
||
40 | use Authenticatable, |
||
41 | CanResetPassword, |
||
42 | Traits\User\CountTrait, |
||
43 | Traits\User\RelationTrait, |
||
44 | Traits\User\CrudTrait, |
||
45 | Traits\User\QueryTrait; |
||
46 | |||
47 | /** |
||
48 | * User name is private. |
||
49 | * |
||
50 | * @var int |
||
51 | */ |
||
52 | const PRIVATE_YES = 1; |
||
53 | |||
54 | /** |
||
55 | * User name is public. |
||
56 | * |
||
57 | * @var int |
||
58 | */ |
||
59 | const PRIVATE_NO = 0; |
||
60 | |||
61 | /** |
||
62 | * User status Deleted. |
||
63 | * |
||
64 | * @var int |
||
65 | */ |
||
66 | const DELETED_USERS = 1; |
||
67 | |||
68 | /** |
||
69 | * User status not deleted. |
||
70 | * |
||
71 | * @var int |
||
72 | */ |
||
73 | const NOT_DELETED_USERS = 0; |
||
74 | |||
75 | /** |
||
76 | * User status active. (Standard). |
||
77 | * |
||
78 | * @var int |
||
79 | */ |
||
80 | const ACTIVE_USER = 1; |
||
81 | |||
82 | /** |
||
83 | * User status blocked. (Too many login attempts). |
||
84 | * |
||
85 | * @var int |
||
86 | */ |
||
87 | const BLOCKED_USER = 2; |
||
88 | |||
89 | /** |
||
90 | * User status inactive. (Cannot login at the moment). |
||
91 | * |
||
92 | * @var int |
||
93 | */ |
||
94 | const INACTIVE_USER = 0; |
||
95 | |||
96 | /** |
||
97 | * The database table used by the model. |
||
98 | * |
||
99 | * @var string |
||
100 | */ |
||
101 | protected $table = 'users'; |
||
102 | |||
103 | /** |
||
104 | * The attributes that are mass assignable. |
||
105 | * |
||
106 | * @var array |
||
107 | */ |
||
108 | protected $fillable = ['deleted', 'email', 'password', 'firstname', 'lastname', 'role_id', 'private', 'language', 'status']; |
||
109 | |||
110 | /** |
||
111 | * The attributes excluded from the model's JSON form. |
||
112 | * |
||
113 | * @var array |
||
114 | */ |
||
115 | protected $hidden = ['password', 'remember_token']; |
||
116 | |||
117 | /** |
||
118 | * Collection of user permissions. |
||
119 | * |
||
120 | * @var Eloquent\Collection |
||
121 | */ |
||
122 | protected $permission; |
||
123 | |||
124 | /** |
||
125 | * Get available languages from translations folder. |
||
126 | * |
||
127 | * @return array |
||
128 | */ |
||
129 | 5 | public static function getLanguages() |
|
142 | |||
143 | /** |
||
144 | * Checks to see if $this user is current user. |
||
145 | * |
||
146 | * @return bool |
||
147 | */ |
||
148 | 3 | public function me() |
|
152 | |||
153 | /** |
||
154 | * Whether or not the user has a permission. |
||
155 | * |
||
156 | * @param string $key |
||
157 | * |
||
158 | * @return bool |
||
159 | */ |
||
160 | 64 | public function permission($key) |
|
171 | |||
172 | /** |
||
173 | * Return user full name with property "fullname". |
||
174 | * |
||
175 | * @return string |
||
176 | */ |
||
177 | 47 | public function getFullNameAttribute() |
|
185 | |||
186 | /** |
||
187 | * Return user image. |
||
188 | * |
||
189 | * @return string |
||
190 | */ |
||
191 | 6 | public function getImageAttribute() |
|
195 | |||
196 | /** |
||
197 | * Returns list of user statuses. |
||
198 | * |
||
199 | * @return array |
||
200 | */ |
||
201 | 2 | public static function getStatuses() |
|
209 | |||
210 | /** |
||
211 | * Whether or not the user is active. |
||
212 | * |
||
213 | * @return bool |
||
214 | */ |
||
215 | 7 | public function isActive() |
|
219 | |||
220 | /** |
||
221 | * Whether or not the user is inactive. |
||
222 | * |
||
223 | * @return bool |
||
224 | */ |
||
225 | public function isInactive() |
||
229 | |||
230 | /** |
||
231 | * Whether or not the user is blocked. |
||
232 | * |
||
233 | * @return bool |
||
234 | */ |
||
235 | public function isBlocked() |
||
239 | |||
240 | /** |
||
241 | * Whether or not the user is normal user role. |
||
242 | * |
||
243 | * @return bool |
||
244 | */ |
||
245 | 36 | public function isUser() |
|
249 | |||
250 | /** |
||
251 | * Whether or not the user is administrator. |
||
252 | * |
||
253 | * @return bool |
||
254 | */ |
||
255 | public function isAdmin() |
||
259 | } |
||
260 |
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.