1 | <?php |
||
21 | class Project extends Model implements HasPresenter |
||
22 | { |
||
23 | use SoftDeletes, ValidatingTrait; |
||
24 | |||
25 | /** |
||
26 | * List of attributes that have default values. |
||
27 | * |
||
28 | * @var mixed[] |
||
29 | */ |
||
30 | protected $attributes = [ |
||
31 | 'namespace_id' => 0, |
||
32 | 'description' => '', |
||
33 | 'path' => '', |
||
34 | 'creator_id' => 0, |
||
35 | ]; |
||
36 | |||
37 | /** |
||
38 | * The attributes that should be casted to native types. |
||
39 | * |
||
40 | * @var string[] |
||
41 | */ |
||
42 | protected $casts = [ |
||
43 | 'id' => 'int', |
||
44 | 'namespace_id' => 'int', |
||
45 | 'description' => 'string', |
||
46 | 'path' => 'string', |
||
47 | 'creator_id' => 'int', |
||
48 | 'deleted_at' => 'date', |
||
49 | ]; |
||
50 | |||
51 | /** |
||
52 | * The fillable properties. |
||
53 | * |
||
54 | * @var string[] |
||
55 | */ |
||
56 | protected $fillable = [ |
||
57 | 'name', |
||
58 | 'description', |
||
59 | 'visibility_level', |
||
60 | 'tags', |
||
61 | 'path', |
||
62 | 'creator_id', |
||
63 | 'namespace_id', |
||
64 | ]; |
||
65 | |||
66 | /** |
||
67 | * The validation rules. |
||
68 | * |
||
69 | * @var string[] |
||
70 | */ |
||
71 | public $rules = [ |
||
72 | 'name' => 'required|string', |
||
73 | 'visibility_level' => 'int|required', |
||
74 | 'path' => 'required|string|max:15', |
||
75 | ]; |
||
76 | |||
77 | /** |
||
78 | * Projects can belong to a group. |
||
79 | * |
||
80 | * @return \Illuminate\Database\Eloquent\Relations\BelongsTo |
||
81 | */ |
||
82 | public function group() |
||
86 | |||
87 | /** |
||
88 | * Projects can belong to a namespace. |
||
89 | * |
||
90 | * @return \Illuminate\Database\Eloquent\Relations\BelongsTo |
||
91 | */ |
||
92 | public function projectNamespace() |
||
96 | |||
97 | /** |
||
98 | * Lookup all of the issues reported on the project. |
||
99 | * |
||
100 | * @return \Illuminate\Database\Eloquent\Relations\HasMany |
||
101 | */ |
||
102 | public function issues() |
||
106 | |||
107 | /** |
||
108 | * Projects can have many tags. |
||
109 | * |
||
110 | * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany |
||
111 | */ |
||
112 | public function tags() |
||
116 | |||
117 | /** |
||
118 | * Finds all projects by visibility_level. |
||
119 | * |
||
120 | * @param \Illuminate\Database\Eloquent\Builder $query |
||
121 | * @param int $visibility_level |
||
122 | * |
||
123 | * @return \Illuminate\Database\Eloquent\Builder |
||
124 | */ |
||
125 | public function scopeVisibilityLevel(Builder $query, $visibility_level) |
||
129 | |||
130 | /** |
||
131 | * Finds all projects which don't have the given visibility_level. |
||
132 | * |
||
133 | * @param \Illuminate\Database\Eloquent\Builder $query |
||
134 | * @param int $visibility_level |
||
135 | * |
||
136 | * @return \Illuminate\Database\Eloquent\Builder |
||
137 | */ |
||
138 | public function scopeNotVisibilityLevel(Builder $query, $visibility_level) |
||
142 | |||
143 | /** |
||
144 | * Looks up the human readable version of the visibility_level. |
||
145 | * |
||
146 | * @return string |
||
147 | */ |
||
148 | public function getHumanVisibilityLevelAttribute() |
||
152 | |||
153 | /** |
||
154 | * Returns the namespace on this project. |
||
155 | * |
||
156 | * @return string |
||
157 | */ |
||
158 | public function getNamespaceAttribute() |
||
162 | |||
163 | /** |
||
164 | * Returns all of the tags on this project. |
||
165 | * |
||
166 | * @return string |
||
167 | */ |
||
168 | public function getTagsListAttribute() |
||
176 | |||
177 | /** |
||
178 | * Get the presenter class. |
||
179 | * |
||
180 | * @return string |
||
181 | */ |
||
182 | public function getPresenterClass() |
||
186 | } |
||
187 |
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.