1 | <?php |
||
8 | class User extends Authenticatable |
||
9 | { |
||
10 | use Notifiable; |
||
11 | |||
12 | /** |
||
13 | * The attributes that are mass assignable. |
||
14 | * |
||
15 | * @var array |
||
16 | */ |
||
17 | protected $fillable = [ |
||
18 | 'name', 'username', 'email', 'password', |
||
19 | ]; |
||
20 | |||
21 | /** |
||
22 | * The attributes that should be hidden for arrays. |
||
23 | * |
||
24 | * @var array |
||
25 | */ |
||
26 | protected $hidden = [ |
||
27 | 'password', 'remember_token', |
||
28 | ]; |
||
29 | |||
30 | /** |
||
31 | * The field to be used for route model binding. |
||
32 | * |
||
33 | * @return string |
||
34 | */ |
||
35 | public function getRouteKeyName() |
||
36 | { |
||
37 | return 'username'; |
||
38 | } |
||
39 | |||
40 | /** |
||
41 | * A user may have multiple snippets. |
||
42 | * |
||
43 | * @return \Illuminate\Database\Eloquent\Relations\HasMany |
||
44 | */ |
||
45 | public function snippets() |
||
49 | |||
50 | /** |
||
51 | * A user may have multiple votes. |
||
52 | * |
||
53 | * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany |
||
54 | */ |
||
55 | public function votes() |
||
59 | |||
60 | /** |
||
61 | * Determine if a user voted for a given snippet. |
||
62 | * |
||
63 | * @param Snippet $snippet |
||
64 | * @return bool |
||
65 | */ |
||
66 | public function votedFor(Snippet $snippet) |
||
70 | } |
||
71 |
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.