|
@@ -23,7 +23,12 @@ class TaskResource extends JsonResource
|
|
|
"status" => $this->status,
|
|
|
"assign_to" => new UserProfileResource($this->assignTo),
|
|
|
"created_by" => new UserProfileResource($this->createdBy),
|
|
|
- "children" => TaskResource::collection($this->children),
|
|
|
+ //"children" => TaskResource::collection($this->children),
|
|
|
+ 'children' => $this->when($this->children->isNotEmpty(),function (){
|
|
|
+ return $this->children->map(function ($child){
|
|
|
+ return new TaskResource($child);
|
|
|
+ })->all();
|
|
|
+ }),
|
|
|
];
|
|
|
}
|
|
|
}
|