1 | <?php |
||
11 | trait ManagesPortfolio |
||
12 | { |
||
13 | use ManagesPages, ManagesProjects; |
||
14 | |||
15 | /** |
||
16 | * Child relationships for HasContent models. |
||
17 | * |
||
18 | * @var array |
||
19 | */ |
||
20 | protected $children = [ |
||
21 | 'blocks' => 'addBlockToModel', |
||
22 | 'lines' => 'addLineToModel', |
||
23 | 'links' => 'addLinkToModel', |
||
24 | ]; |
||
25 | |||
26 | /** |
||
27 | * Add children resources to model. |
||
28 | * |
||
29 | * @param \Larafolio\Models\HasContent $model Model to add children to. |
||
30 | * @param array $data Array of posted user data. |
||
31 | * |
||
32 | * @return \Larafolio\Models\HasContent |
||
33 | */ |
||
34 | protected function addModelChildren(HasContent $model, array $data) |
||
44 | |||
45 | /** |
||
46 | * Update a HasContent model and its children. |
||
47 | * |
||
48 | * @param \Larafolio\Models\HasContent $model Model to update. |
||
49 | * @param array $data Array of posted user data. |
||
50 | * |
||
51 | * @return \Larafolio\Models\HasContent |
||
52 | */ |
||
53 | protected function updateModel(HasContent $model, array $data) |
||
65 | |||
66 | /** |
||
67 | * Permanently delete a model. |
||
68 | * |
||
69 | * @param \Larafolio\Models\HasContent $model Model to delete. |
||
70 | * |
||
71 | * @return bool |
||
72 | */ |
||
73 | protected function purgeModel(HasContent $model) |
||
83 | |||
84 | /** |
||
85 | * Set order of data based on order value. |
||
86 | * |
||
87 | * @param array $data Data array containing 'order' index. |
||
88 | * |
||
89 | * @return \Illuminate\Support\Collection |
||
90 | */ |
||
91 | protected function setOrder(array $data) |
||
100 | |||
101 | /** |
||
102 | * Add a text block to a model. |
||
103 | * |
||
104 | * @param \Larafolio\Models\HasContent $model Model to add text block to. |
||
105 | * @param array $blockData Array of text block data. |
||
106 | * |
||
107 | * @return \Larafolio\Models\HasContent |
||
108 | */ |
||
109 | public function addBlockToModel(HasContent $model, array $blockData) |
||
113 | |||
114 | /** |
||
115 | * Update a text block. |
||
116 | * |
||
117 | * @param \Larafolio\Models\TextBlock $textBlock Text block to update. |
||
118 | * @param array $blockData Array of text block data. |
||
119 | * |
||
120 | * @return \Larafolio\Models\TextBlock |
||
121 | */ |
||
122 | public function updateTextBlock(TextBlock $textBlock, array $blockData) |
||
128 | |||
129 | /** |
||
130 | * Update model text blocks by adding new ones and updating existing ones. |
||
131 | * |
||
132 | * @param \Larafolio\Models\HasContent $model Model that blocks belong to. |
||
133 | * @param array $data Array of model information. |
||
134 | */ |
||
135 | public function updateAllTextBlocks(HasContent $model, array $data) |
||
149 | |||
150 | /** |
||
151 | * Remove a text block from a model. |
||
152 | * |
||
153 | * @param \Larafolio\Models\TextBlock $textBlock The text block to delete. |
||
154 | * |
||
155 | * @return bool|null |
||
156 | */ |
||
157 | public function removeTextBlock(TextBlock $textBlock) |
||
161 | |||
162 | /** |
||
163 | * Add a text line to a model. |
||
164 | * |
||
165 | * @param \Larafolio\Models\HasContent $model Model to add text line to. |
||
166 | * @param array $lineData Array of text line data. |
||
167 | * |
||
168 | * @return \Larafolio\Models\HasContent |
||
169 | */ |
||
170 | public function addLineToModel(HasContent $model, array $lineData) |
||
174 | |||
175 | /** |
||
176 | * Update a text line. |
||
177 | * |
||
178 | * @param \Larafolio\Models\TextLine $textLine Text line to update. |
||
179 | * @param array $lineData Array of text line data. |
||
180 | * |
||
181 | * @return \Larafolio\Models\TextLine |
||
182 | */ |
||
183 | public function updateTextLine(TextLine $textLine, array $lineData) |
||
189 | |||
190 | /** |
||
191 | * Update model text lines by adding new ones and updating existing ones. |
||
192 | * |
||
193 | * @param \Larafolio\Models\HasContent $model Model that lines belong to. |
||
194 | * @param array $data Array of model information. |
||
195 | */ |
||
196 | public function updateAllTextLines(HasContent $model, array $data) |
||
210 | |||
211 | /** |
||
212 | * Remove a text line from a model. |
||
213 | * |
||
214 | * @param \Larafolio\Models\TextLine $textLine The text line to delete. |
||
215 | * |
||
216 | * @return bool|null |
||
217 | */ |
||
218 | public function removeTextLine(TextLine $textLine) |
||
222 | |||
223 | /** |
||
224 | * Add image to a model. |
||
225 | * |
||
226 | * @param \Larafolio\Models\HasContent $model Model to add image to. |
||
227 | * @param array $imageData Array of image infomation. |
||
228 | * |
||
229 | * @return \Larafolio\Models\HasContent |
||
230 | */ |
||
231 | public function addImageToModel(HasContent $model, array $imageData) |
||
235 | |||
236 | /** |
||
237 | * Update image name and caption. |
||
238 | * |
||
239 | * @param \Larafolio\Models\Image $image Image to update. |
||
240 | * @param array $imageData Array of inmage information. |
||
241 | * |
||
242 | * @return \Larafolio\Models\Image |
||
243 | */ |
||
244 | public function updateImageInfo(Image $image, array $imageData) |
||
250 | |||
251 | /** |
||
252 | * Remove image from storage and delete database info if path is unique. |
||
253 | * |
||
254 | * @param \Larafolio\Models\Image $image Image to remove. |
||
255 | * |
||
256 | * @return bool|null |
||
257 | */ |
||
258 | public function removeImage(Image $image) |
||
268 | |||
269 | /** |
||
270 | * Add a link to a model. |
||
271 | * |
||
272 | * @param \Larafolio\Models\HasContent $model Model to add link to. |
||
273 | * @param array $linkData Array of link info. |
||
274 | */ |
||
275 | public function addLinkToModel(HasContent $model, array $linkData) |
||
279 | |||
280 | /** |
||
281 | * Update a link. |
||
282 | * |
||
283 | * @param \Larafolio\Models\Link $link Link to update. |
||
284 | * @param array $linkData Array of link data. |
||
285 | * |
||
286 | * @return \Larafolio\Models\Link |
||
287 | */ |
||
288 | public function updateLink(Link $link, array $linkData) |
||
294 | |||
295 | /** |
||
296 | * Update model links by adding new ones and updating existing ones. |
||
297 | * |
||
298 | * @param \Larafolio\Models\HasContent $model Model that links belong to. |
||
299 | * @param array $data Array of model information. |
||
300 | */ |
||
301 | public function updateAllLinks(HasContent $model, array $data) |
||
315 | |||
316 | /** |
||
317 | * Remove link from a model. |
||
318 | * |
||
319 | * @param \Larafolio\Models\Link $link Link to remove. |
||
320 | * |
||
321 | * @return bool|null |
||
322 | */ |
||
323 | public function removeLink(Link $link) |
||
327 | |||
328 | /** |
||
329 | * Update content associated with model. |
||
330 | * |
||
331 | * @param \Larafolio\Models\HasContent $model Model associated with content. |
||
332 | * @param string $type Type of model. |
||
333 | * @param array $data user posted data. |
||
334 | * @param callable $updateCallback Callback to update the content. |
||
335 | * @param callable $addCallback Callback to add new content. |
||
336 | */ |
||
337 | protected function updateContent( |
||
356 | } |
||
357 |
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.