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 | * Return all visible projects. |
||
30 | * |
||
31 | * @param bool $group If true, group projects by 'type'. |
||
32 | * @param bool $order If true, order projects by 'order'. |
||
33 | * |
||
34 | * @return \Illuminate\Support\Collection |
||
35 | */ |
||
36 | public static function allVisible($group = true, $order = true) |
||
37 | { |
||
38 | $query = static::where('visible', true); |
||
39 | |||
40 | return static::orderAndGroupQuery($query, $group, $order); |
||
41 | } |
||
42 | |||
43 | /** |
||
44 | * Return all hidden projects. |
||
45 | * |
||
46 | * @param bool $group If true, group projects by 'type'. |
||
47 | * @param bool $order If true, order projects by 'order'. |
||
48 | * |
||
49 | * @return \Illuminate\Support\Collection |
||
50 | */ |
||
51 | public static function allHidden($group = true, $order = true) |
||
52 | { |
||
53 | $query = static::where('visible', false); |
||
54 | |||
55 | return static::orderAndGroupQuery($query, $group, $order); |
||
56 | } |
||
57 | |||
58 | /** |
||
59 | * Return all projects grouped by 'type'. |
||
60 | * |
||
61 | * @param bool $order If true, order projects by 'order'. |
||
62 | * |
||
63 | * @return \Illuminate\Support\Collection |
||
64 | */ |
||
65 | public static function allGrouped($order = true) |
||
71 | |||
72 | /** |
||
73 | * Return all projects ordered by 'order'. |
||
74 | * |
||
75 | * @return \Illuminate\Support\Collection |
||
76 | */ |
||
77 | public static function allOrdered() |
||
83 | |||
84 | /** |
||
85 | * Get all projects with given block name. |
||
86 | * |
||
87 | * @param string $blockName Name of block. |
||
88 | * |
||
89 | * @return \Illuminate\Support\Collection |
||
90 | */ |
||
91 | public static function hasBlockNamed($blockName) |
||
95 | |||
96 | /** |
||
97 | * Get all projects with given image name. |
||
98 | * |
||
99 | * @param string $imageName Name of image. |
||
100 | * |
||
101 | * @return \Illuminate\Support\Collection |
||
102 | */ |
||
103 | public static function hasImageNamed($imageName) |
||
107 | |||
108 | /** |
||
109 | * Get all projects with given link name. |
||
110 | * |
||
111 | * @param string $linkName Name of link. |
||
112 | * |
||
113 | * @return \Illuminate\Support\Collection |
||
114 | */ |
||
115 | public static function hasLinkNamed($linkName) |
||
119 | |||
120 | /** |
||
121 | * Get formatted text of block with project name or first block. |
||
122 | * |
||
123 | * @return \Larafolio\Models\TextBlock |
||
124 | */ |
||
125 | public function getProjectBlock() |
||
135 | |||
136 | /** |
||
137 | * Get formatted text of block with project name or first block. |
||
138 | * |
||
139 | * @param bool $formatted If true, return formatted text. |
||
140 | * |
||
141 | * @return string |
||
142 | */ |
||
143 | public function getProjectBlockText($formatted = true) |
||
155 | |||
156 | /** |
||
157 | * Get url of small image with project name or first image in collection. |
||
158 | * |
||
159 | * @return \Larafolio\Models\Image |
||
160 | */ |
||
161 | public function getProjectImage() |
||
171 | |||
172 | /** |
||
173 | * Get url of small image with project name or first image in collection. |
||
174 | * |
||
175 | * @param string $size The size of the image, name of image cache filter. |
||
176 | * |
||
177 | * @return string |
||
178 | */ |
||
179 | public function getProjectImageUrl($size = 'small') |
||
189 | } |
||
190 |
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.