1 | <?php |
||
52 | class User extends ModelAbstract implements UserInterface |
||
53 | { |
||
54 | use Authenticatable, |
||
55 | CanResetPassword, |
||
56 | UserRelations, |
||
57 | UserScopes, |
||
58 | LoggedUser, |
||
59 | Authorizable; |
||
60 | |||
61 | /** |
||
62 | * User name is private. |
||
63 | * |
||
64 | * @var int |
||
65 | */ |
||
66 | const PRIVATE_YES = 1; |
||
67 | |||
68 | /** |
||
69 | * User name is public. |
||
70 | * |
||
71 | * @var int |
||
72 | */ |
||
73 | const PRIVATE_NO = 0; |
||
74 | |||
75 | /** |
||
76 | * User status Deleted. |
||
77 | * |
||
78 | * @var int |
||
79 | */ |
||
80 | const DELETED_USERS = 1; |
||
81 | |||
82 | /** |
||
83 | * User status not deleted. |
||
84 | * |
||
85 | * @var int |
||
86 | */ |
||
87 | const NOT_DELETED_USERS = 0; |
||
88 | |||
89 | /** |
||
90 | * User status active. (Standard). |
||
91 | * |
||
92 | * @var int |
||
93 | */ |
||
94 | const ACTIVE_USER = 1; |
||
95 | |||
96 | /** |
||
97 | * User status blocked. (Too many login attempts). |
||
98 | * |
||
99 | * @var int |
||
100 | */ |
||
101 | const BLOCKED_USER = 2; |
||
102 | |||
103 | /** |
||
104 | * User status inactive. (Cannot login at the moment). |
||
105 | * |
||
106 | * @var int |
||
107 | */ |
||
108 | const INACTIVE_USER = 0; |
||
109 | |||
110 | /** |
||
111 | * The database table used by the model. |
||
112 | * |
||
113 | * @var string |
||
114 | */ |
||
115 | protected $table = 'users'; |
||
116 | |||
117 | /** |
||
118 | * The attributes that are mass assignable. |
||
119 | * |
||
120 | * @var array |
||
121 | */ |
||
122 | protected $fillable = ['deleted', 'email', 'password', 'firstname', 'lastname', 'role_id', 'private', 'language', 'status']; |
||
123 | |||
124 | /** |
||
125 | * The attributes excluded from the model's JSON form. |
||
126 | * |
||
127 | * @var array |
||
128 | */ |
||
129 | protected $hidden = ['password', 'remember_token']; |
||
130 | |||
131 | /** |
||
132 | * Collection of user permissions. |
||
133 | * |
||
134 | * @var Eloquent\Collection |
||
135 | */ |
||
136 | protected $permission; |
||
137 | |||
138 | /** |
||
139 | * Checks to see if $this user is current user. |
||
140 | * |
||
141 | * @return bool |
||
142 | */ |
||
143 | public function me() |
||
147 | |||
148 | /** |
||
149 | * Return user full name with property "fullname". |
||
150 | * |
||
151 | * @return string |
||
152 | */ |
||
153 | public function getFullNameAttribute() |
||
161 | |||
162 | /** |
||
163 | * Return user image. |
||
164 | * |
||
165 | * @return string |
||
166 | */ |
||
167 | public function getImageAttribute() |
||
171 | |||
172 | /** |
||
173 | * Returns list of user statuses. |
||
174 | * |
||
175 | * @return array |
||
176 | */ |
||
177 | public static function getStatuses() |
||
185 | |||
186 | /** |
||
187 | * Whether or not the user is active. |
||
188 | * |
||
189 | * @return bool |
||
190 | */ |
||
191 | public function isActive() |
||
195 | |||
196 | /** |
||
197 | * Whether or not the user is inactive. |
||
198 | * |
||
199 | * @return bool |
||
200 | */ |
||
201 | public function isInactive() |
||
205 | |||
206 | /** |
||
207 | * Whether or not the user is blocked. |
||
208 | * |
||
209 | * @return bool |
||
210 | */ |
||
211 | public function isBlocked() |
||
215 | |||
216 | /** |
||
217 | * Whether or not the user is normal user role. |
||
218 | * |
||
219 | * @return bool |
||
220 | */ |
||
221 | public function isUser() |
||
225 | |||
226 | /** |
||
227 | * Whether or not the user is administrator. |
||
228 | * |
||
229 | * @return bool |
||
230 | */ |
||
231 | public function isAdmin() |
||
235 | |||
236 | /** |
||
237 | * Whether or not the user is manager. |
||
238 | * |
||
239 | * @return bool |
||
240 | */ |
||
241 | public function isManager() |
||
245 | /** |
||
246 | * Whether or not the user is developer. |
||
247 | * |
||
248 | * @return bool |
||
249 | */ |
||
250 | public function isDeveloper() |
||
254 | |||
255 | public function isManagerOrMore() |
||
259 | |||
260 | public function isDeveloperOrMore() |
||
264 | |||
265 | public function getRoleName() |
||
269 | } |
||
270 |
If you access a property on an interface, you most likely code against a concrete implementation of the interface.
Available Fixes
Adding an additional type check:
Changing the type hint: