1 | <?php |
||
11 | class Project extends HasContent |
||
12 | { |
||
13 | use Sluggable, SoftDeletes; |
||
14 | |||
15 | /** |
||
16 | * The table associated with the model. |
||
17 | * |
||
18 | * @var string |
||
19 | */ |
||
20 | protected $table = 'projects'; |
||
21 | |||
22 | /** |
||
23 | * The attributes that are mass assignable. |
||
24 | * |
||
25 | * @var array |
||
26 | */ |
||
27 | protected $fillable = [ |
||
28 | 'name', 'slug', 'type', 'visible', 'order', |
||
29 | ]; |
||
30 | |||
31 | /** |
||
32 | * Properties to always eager load. |
||
33 | * |
||
34 | * @var array |
||
35 | */ |
||
36 | protected $with = ['blocks', 'images', 'links']; |
||
37 | |||
38 | /** |
||
39 | * The attributes that should be casted to native types. |
||
40 | * |
||
41 | * @var array |
||
42 | */ |
||
43 | protected $casts = [ |
||
44 | 'visible' => 'boolean', |
||
45 | ]; |
||
46 | |||
47 | /** |
||
48 | * Fields that are dates. |
||
49 | * |
||
50 | * @var array |
||
51 | */ |
||
52 | protected $dates = ['created_at', 'updated_at', 'deleted_at']; |
||
53 | |||
54 | /** |
||
55 | * Get the route key for the model. |
||
56 | * |
||
57 | * @return string |
||
58 | */ |
||
59 | public function getRouteKeyName() |
||
63 | |||
64 | /** |
||
65 | * Bootstrap model. |
||
66 | */ |
||
67 | public static function boot() |
||
79 | |||
80 | /** |
||
81 | * Return all visible projects. |
||
82 | * |
||
83 | * @param bool $group If true, group projects by 'type'. |
||
84 | * @param bool $order If true, order projects by 'order'. |
||
85 | * |
||
86 | * @return \Illuminate\Support\Collection |
||
87 | */ |
||
88 | public static function allVisible($group = true, $order = true) |
||
94 | |||
95 | /** |
||
96 | * Return all hidden projects. |
||
97 | * |
||
98 | * @param bool $group If true, group projects by 'type'. |
||
99 | * @param bool $order If true, order projects by 'order'. |
||
100 | * |
||
101 | * @return \Illuminate\Support\Collection |
||
102 | */ |
||
103 | public static function allHidden($group = true, $order = true) |
||
109 | |||
110 | /** |
||
111 | * Return all projects grouped by 'type'. |
||
112 | * |
||
113 | * @param bool $order If true, order projects by 'order'. |
||
114 | * |
||
115 | * @return \Illuminate\Support\Collection |
||
116 | */ |
||
117 | public static function allGrouped($order = true) |
||
123 | |||
124 | /** |
||
125 | * Return all projects ordered by 'order'. |
||
126 | * |
||
127 | * @return \Illuminate\Support\Collection |
||
128 | */ |
||
129 | public static function allOrdered() |
||
135 | |||
136 | /** |
||
137 | * Order and group query, return results. |
||
138 | * |
||
139 | * @param Builder $query Query to be ordered. |
||
140 | * @param bool $group If true, group projects by 'type'. |
||
141 | * @param bool $order If true, order projects by 'order'. |
||
142 | * |
||
143 | * @return \Illuminate\Support\Collection |
||
144 | */ |
||
145 | protected static function orderAndGroupQuery($query, $group, $order) |
||
165 | |||
166 | /** |
||
167 | * Get all projects with given block name. |
||
168 | * |
||
169 | * @param string $blockName Name of block. |
||
170 | * |
||
171 | * @return \Illuminate\Support\Collection |
||
172 | */ |
||
173 | public static function hasBlockNamed($blockName) |
||
177 | |||
178 | /** |
||
179 | * Get all projects with given image name. |
||
180 | * |
||
181 | * @param string $imageName Name of image. |
||
182 | * |
||
183 | * @return \Illuminate\Support\Collection |
||
184 | */ |
||
185 | public static function hasImageNamed($imageName) |
||
189 | |||
190 | /** |
||
191 | * Get all projects with given link name. |
||
192 | * |
||
193 | * @param string $linkName Name of link. |
||
194 | * |
||
195 | * @return \Illuminate\Support\Collection |
||
196 | */ |
||
197 | public static function hasLinkNamed($linkName) |
||
201 | |||
202 | /** |
||
203 | * Get all projects with relationship on table that has given name. |
||
204 | * |
||
205 | * @param string $table Name of table relationship is on. |
||
206 | * @param string $name Relationship name. |
||
207 | * |
||
208 | * @return \Illuminate\Support\Collection |
||
209 | */ |
||
210 | protected static function hasRelationshipNamed($table, $name) |
||
217 | |||
218 | /** |
||
219 | * Return the project id. |
||
220 | * |
||
221 | * @return int |
||
222 | */ |
||
223 | public function id() |
||
227 | |||
228 | /** |
||
229 | * Return the project name. |
||
230 | * |
||
231 | * @return string |
||
232 | */ |
||
233 | public function name() |
||
237 | |||
238 | /** |
||
239 | * Return the project type. |
||
240 | * |
||
241 | * @return string |
||
242 | */ |
||
243 | public function type() |
||
247 | |||
248 | /** |
||
249 | * Return the project slug. |
||
250 | * |
||
251 | * @return string |
||
252 | */ |
||
253 | public function slug() |
||
257 | |||
258 | /** |
||
259 | * Return the project order value. |
||
260 | * |
||
261 | * @return int |
||
262 | */ |
||
263 | public function order() |
||
267 | |||
268 | /** |
||
269 | * Get formatted text of block named description or first block. |
||
270 | * |
||
271 | * @return Larafolio\Models\TextBlock |
||
272 | */ |
||
273 | public function getProjectBlock() |
||
283 | |||
284 | /** |
||
285 | * Get formatted text of block named description or first block. |
||
286 | * |
||
287 | * @param bool $formatted If true, return formatted text. |
||
288 | * |
||
289 | * @return string |
||
290 | */ |
||
291 | public function getProjectBlockText($formatted = true) |
||
303 | |||
304 | /** |
||
305 | * Get url of small image with project name or first image in collection. |
||
306 | * |
||
307 | * @return string |
||
308 | */ |
||
309 | public function getProjectImage() |
||
319 | |||
320 | /** |
||
321 | * Get url of small image with project name or first image in collection. |
||
322 | * |
||
323 | * @param string $size The size of the image, name of image cache filter. |
||
324 | * |
||
325 | * @return string |
||
326 | */ |
||
327 | public function getProjectImageUrl($size = 'small') |
||
337 | |||
338 | /** |
||
339 | * Get blocks sorted by order. |
||
340 | * |
||
341 | * @param \Builder $query Query builder. |
||
342 | * @param string $slug Project slug. |
||
343 | * |
||
344 | * @return \Builder |
||
345 | */ |
||
346 | public function scopeWithBlocks($query, $slug) |
||
351 | |||
352 | /** |
||
353 | * Get full project info (blocks and links sorted by order). |
||
354 | * |
||
355 | * @param \Builder $query Query builder. |
||
356 | * @param string $slug Project slug. |
||
357 | * |
||
358 | * @return \Builder |
||
359 | */ |
||
360 | public function scopeFull($query, $slug) |
||
366 | |||
367 | /** |
||
368 | * Return images with all props needed for javascript. |
||
369 | * |
||
370 | * @return Collection |
||
371 | */ |
||
372 | public function imagesWithProps() |
||
379 | |||
380 | /** |
||
381 | * Order given relationship by order value. |
||
382 | * |
||
383 | * @param \Builder $query Query builder. |
||
384 | * @param string $relationship Name of relationship to order. |
||
385 | * |
||
386 | * @return \Builder |
||
387 | */ |
||
388 | public function scopeOrderRelationship($query, $relationship) |
||
394 | |||
395 | /** |
||
396 | * Return project properties to be passed to js. |
||
397 | * |
||
398 | * @return array |
||
399 | */ |
||
400 | public function generateProps() |
||
409 | } |
||
410 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: