1 | <?php |
||
7 | class Guitar extends Eloquent\Model |
||
8 | { |
||
9 | /** |
||
10 | * We do not want any timestamps. |
||
11 | * |
||
12 | * @var bool |
||
13 | */ |
||
14 | public $timestamps = false; |
||
15 | |||
16 | /** |
||
17 | * The attributes that are not mass assignable. |
||
18 | * |
||
19 | * @var array |
||
20 | */ |
||
21 | protected $guarded = []; |
||
22 | |||
23 | /** |
||
24 | * Sold guitars. |
||
25 | * |
||
26 | * @param $query |
||
27 | * |
||
28 | * @return Eloquent\Builder |
||
29 | */ |
||
30 | public function scopeSold($query) |
||
31 | { |
||
32 | return $query->has('sale'); |
||
33 | } |
||
34 | |||
35 | /** |
||
36 | * Unsold Guitars. |
||
37 | * |
||
38 | * @param $query |
||
39 | * |
||
40 | * @return Eloquent\Builder |
||
41 | */ |
||
42 | 1 | public function scopeUnsold($query) |
|
46 | |||
47 | /** |
||
48 | * Make of the guitar. |
||
49 | * |
||
50 | * @return Eloquent\Relations\BelongsTo |
||
51 | */ |
||
52 | public function make() |
||
53 | { |
||
54 | return $this->belongsTo(Make::class); |
||
55 | } |
||
56 | |||
57 | /** |
||
58 | * Model of the guitar. |
||
59 | * |
||
60 | * @return Eloquent\Relations\BelongsTo |
||
61 | */ |
||
62 | public function model() |
||
63 | { |
||
64 | return $this->belongsTo(Model::class); |
||
65 | } |
||
66 | |||
67 | /** |
||
68 | * Rack where guitar is stored. |
||
69 | * |
||
70 | * @return Eloquent\Relations\BelongsTo |
||
71 | */ |
||
72 | public function rack() |
||
73 | { |
||
74 | return $this->belongsTo(Rack::class); |
||
75 | } |
||
76 | |||
77 | /** |
||
78 | * The shipment in which the guitar was bought. |
||
79 | * |
||
80 | * @return Eloquent\Relations\BelongsTo |
||
81 | */ |
||
82 | public function purchase() |
||
83 | { |
||
84 | return $this->belongsTo(Purchase::class); |
||
85 | } |
||
86 | |||
87 | /** |
||
88 | * Sale record of the guitar. |
||
89 | * |
||
90 | * @return Eloquent\Relations\HasOne |
||
91 | */ |
||
92 | 1 | public function sale() |
|
96 | |||
97 | /** |
||
98 | * Status of the guitar. |
||
99 | * @return bool |
||
100 | */ |
||
101 | public function isSold() |
||
105 | } |
||
106 |
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.