1 | <?php |
||
8 | class Project extends HasContent |
||
9 | { |
||
10 | use Sluggable, SoftDeletes; |
||
11 | |||
12 | /** |
||
13 | * The table associated with the model. |
||
14 | * |
||
15 | * @var string |
||
16 | */ |
||
17 | protected $table = 'projects'; |
||
18 | |||
19 | /** |
||
20 | * The attributes that are mass assignable. |
||
21 | * |
||
22 | * @var array |
||
23 | */ |
||
24 | protected $fillable = [ |
||
25 | 'name', 'slug', 'type', 'visible', 'order', |
||
26 | ]; |
||
27 | |||
28 | /** |
||
29 | * Properties to always eager load. |
||
30 | * |
||
31 | * @var array |
||
32 | */ |
||
33 | protected $with = ['blocks', 'images', 'links']; |
||
34 | |||
35 | /** |
||
36 | * The attributes that should be casted to native types. |
||
37 | * |
||
38 | * @var array |
||
39 | */ |
||
40 | protected $casts = [ |
||
41 | 'visible' => 'boolean', |
||
42 | ]; |
||
43 | |||
44 | /** |
||
45 | * Fields that are dates. |
||
46 | * |
||
47 | * @var array |
||
48 | */ |
||
49 | protected $dates = ['created_at', 'updated_at', 'deleted_at']; |
||
50 | |||
51 | /** |
||
52 | * Get the route key for the model. |
||
53 | * |
||
54 | * @return string |
||
55 | */ |
||
56 | public function getRouteKeyName() |
||
60 | |||
61 | /** |
||
62 | * Return all visible projects. |
||
63 | * |
||
64 | * @param bool $group If true, group projects by 'type'. |
||
65 | * @param bool $order If true, order projects by 'order'. |
||
66 | * |
||
67 | * @return \Illuminate\Support\Collection |
||
68 | */ |
||
69 | public static function allVisible($group = true, $order = true) |
||
75 | |||
76 | /** |
||
77 | * Return all hidden projects. |
||
78 | * |
||
79 | * @param bool $group If true, group projects by 'type'. |
||
80 | * @param bool $order If true, order projects by 'order'. |
||
81 | * |
||
82 | * @return \Illuminate\Support\Collection |
||
83 | */ |
||
84 | public static function allHidden($group = true, $order = true) |
||
90 | |||
91 | /** |
||
92 | * Return all projects grouped by 'type'. |
||
93 | * |
||
94 | * @param bool $order If true, order projects by 'order'. |
||
95 | * |
||
96 | * @return \Illuminate\Support\Collection |
||
97 | */ |
||
98 | public static function allGrouped($order = true) |
||
104 | |||
105 | /** |
||
106 | * Return all projects ordered by 'order'. |
||
107 | * |
||
108 | * @return \Illuminate\Support\Collection |
||
109 | */ |
||
110 | public static function allOrdered() |
||
116 | |||
117 | /** |
||
118 | * Get all projects with given block name. |
||
119 | * |
||
120 | * @param string $blockName Name of block. |
||
121 | * |
||
122 | * @return \Illuminate\Support\Collection |
||
123 | */ |
||
124 | public static function hasBlockNamed($blockName) |
||
128 | |||
129 | /** |
||
130 | * Get all projects with given image name. |
||
131 | * |
||
132 | * @param string $imageName Name of image. |
||
133 | * |
||
134 | * @return \Illuminate\Support\Collection |
||
135 | */ |
||
136 | public static function hasImageNamed($imageName) |
||
140 | |||
141 | /** |
||
142 | * Get all projects with given link name. |
||
143 | * |
||
144 | * @param string $linkName Name of link. |
||
145 | * |
||
146 | * @return \Illuminate\Support\Collection |
||
147 | */ |
||
148 | public static function hasLinkNamed($linkName) |
||
152 | |||
153 | /** |
||
154 | * Return the project id. |
||
155 | * |
||
156 | * @return int |
||
157 | */ |
||
158 | public function id() |
||
162 | |||
163 | /** |
||
164 | * Return the project name. |
||
165 | * |
||
166 | * @return string |
||
167 | */ |
||
168 | public function name() |
||
172 | |||
173 | /** |
||
174 | * Return the project type. |
||
175 | * |
||
176 | * @return string |
||
177 | */ |
||
178 | public function type() |
||
182 | |||
183 | /** |
||
184 | * Return the project slug. |
||
185 | * |
||
186 | * @return string |
||
187 | */ |
||
188 | public function slug() |
||
192 | |||
193 | /** |
||
194 | * Return the project order value. |
||
195 | * |
||
196 | * @return int |
||
197 | */ |
||
198 | public function order() |
||
202 | |||
203 | /** |
||
204 | * Get formatted text of block with project name or first block. |
||
205 | * |
||
206 | * @return Larafolio\Models\TextBlock |
||
207 | */ |
||
208 | public function getProjectBlock() |
||
218 | |||
219 | /** |
||
220 | * Get formatted text of block with project name or first block. |
||
221 | * |
||
222 | * @param bool $formatted If true, return formatted text. |
||
223 | * |
||
224 | * @return string |
||
225 | */ |
||
226 | public function getProjectBlockText($formatted = true) |
||
238 | |||
239 | /** |
||
240 | * Get url of small image with project name or first image in collection. |
||
241 | * |
||
242 | * @return Larafolio\Models\Image |
||
243 | */ |
||
244 | public function getProjectImage() |
||
254 | |||
255 | /** |
||
256 | * Get url of small image with project name or first image in collection. |
||
257 | * |
||
258 | * @param string $size The size of the image, name of image cache filter. |
||
259 | * |
||
260 | * @return string |
||
261 | */ |
||
262 | public function getProjectImageUrl($size = 'small') |
||
272 | } |
||
273 |
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.