|
@@ -22,7 +22,12 @@ class RequirementGroupResource extends JsonResource
|
|
|
'asset_id'=>$this->asset_id,
|
|
|
'abbr_name'=>$this->abbr_name,
|
|
|
'parent_id' => $this->parent_id,
|
|
|
- 'children' =>$this->parent_id == 0 ? RequirementGroupResource::collection($this->children) : [],
|
|
|
+ //'children' =>$this->parent_id == 0 ? RequirementGroupResource::collection($this->children) : [],
|
|
|
+ 'children' =>$this->when($this->children->isNotEmpty(),function (){
|
|
|
+ return $this->children->map(function ($child){
|
|
|
+ return new RequirementGroupResource($child);
|
|
|
+ })->all();
|
|
|
+ })
|
|
|
];
|
|
|
}
|
|
|
}
|