forked from ProcessMaker/processmaker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathScreen.php
More file actions
27 lines (24 loc) · 651 Bytes
/
Screen.php
File metadata and controls
27 lines (24 loc) · 651 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<?php
namespace ProcessMaker\Http\Resources;
class Screen extends ApiResource
{
/**
* Transform the resource into an array.
*
* @param \Illuminate\Http\Request
* @return array
*/
public function toArray($request)
{
$screen = parent::toArray($request);
$include = explode(',', $request->input('include', ''));
if (in_array('nested', $include)) {
$nested = [];
foreach ($this->nestedScreenIds() as $id) {
$nested[] = self::findOrFail($id)->toArray();
}
$screen['nested'] = $nested;
}
return $screen;
}
}