1 | <?php |
||
9 | class User extends Authenticatable |
||
10 | { |
||
11 | use Notifiable; |
||
12 | use SoftDeletes; |
||
13 | |||
14 | /** |
||
15 | * The attributes that should be mutated to dates. |
||
16 | * |
||
17 | * @var array |
||
18 | */ |
||
19 | protected $dates = [ |
||
20 | 'deleted_at' |
||
21 | ]; |
||
22 | |||
23 | /** |
||
24 | * The attributes that are mass assignable. |
||
25 | * |
||
26 | * @var array |
||
27 | */ |
||
28 | protected $fillable = [ |
||
29 | 'name', 'email', 'password', 'role', 'phone' |
||
30 | ]; |
||
31 | |||
32 | /** |
||
33 | * The attributes that should be hidden for arrays. |
||
34 | * |
||
35 | * @var array |
||
36 | */ |
||
37 | protected $hidden = [ |
||
38 | 'password', 'remember_token', |
||
39 | ]; |
||
40 | |||
41 | /** |
||
42 | * Route notifications for the Nexmo channel. |
||
43 | * |
||
44 | * @return string |
||
45 | */ |
||
46 | public function routeNotificationForNexmo() |
||
50 | |||
51 | /** |
||
52 | * Is user Admin or better? |
||
53 | * |
||
54 | * @return boolean |
||
55 | */ |
||
56 | public function isAdmin() |
||
57 | { |
||
58 | return $this->role > 2; |
||
59 | } |
||
60 | |||
61 | /** |
||
62 | * Is user Manager or better? |
||
63 | * |
||
64 | * @return boolean |
||
65 | */ |
||
66 | public function isManager() |
||
67 | { |
||
68 | return $this->role > 1; |
||
69 | } |
||
70 | |||
71 | /** |
||
72 | * Is user User or better? |
||
73 | * |
||
74 | * @return boolean |
||
75 | */ |
||
76 | public function isUser() |
||
77 | { |
||
78 | return $this->role > 0; |
||
79 | } |
||
80 | |||
81 | /** |
||
82 | * Is user a guest? |
||
83 | * |
||
84 | * @return boolean |
||
85 | */ |
||
86 | public function isGuest() |
||
90 | } |
||
91 |
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.