-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathIndependentActivityResource.php
More file actions
55 lines (50 loc) · 1.94 KB
/
IndependentActivityResource.php
File metadata and controls
55 lines (50 loc) · 1.94 KB
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<?php
namespace App\Http\Resources\V1;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;
class IndependentActivityResource extends JsonResource
{
/**
* Transform the resource into an array.
*
* @param Request $request
* @return array
*/
public function toArray($request)
{
$data = [
'id' => $this->id,
'title' => $this->title,
'type' => $this->type,
'library_item_title' => $this->h5p_content->library->title,
'content' => $this->content,
'description' => $this->description,
'shared' => $this->shared,
'order' => $this->order,
'thumb_url' => $this->thumb_url,
'created_at' => $this->created_at,
'updated_at' => $this->updated_at,
'gcr_activity_visibility' => $this->organization->gcr_activity_visibility,
'subjects' => SubjectResource::collection($this->subjects),
'education_levels' => EducationLevelResource::collection($this->educationLevels),
'author_tags' => AuthorTagResource::collection($this->authorTags),
'source_type' => $this->source_type,
'source_url' => $this->source_url,
'organization_visibility_type_id' => $this->organization_visibility_type_id,
'organization_id' => $this->organization_id,
'organization_name' => $this->organization->name,
'status' => $this->status,
'status_text' => $this->status_text,
'indexing' => $this->indexing,
'indexing_text' => $this->indexing_text,
'user' => $this->user,
'activity_type' => $this->activity_type
];
// Feature added after the fact for optimization
if ($request->skipContent === "true") {
return $data;
}
$data['h5p_content'] = $this->h5p_content;
return $data;
}
}