visuddhinanda 2 лет назад
Родитель
Сommit
0593eb6963
1 измененных файлов с 1 добавлено и 3 удалено
  1. 1 3
      app/Http/Resources/DiscussionResource.php

+ 1 - 3
app/Http/Resources/DiscussionResource.php

@@ -26,12 +26,10 @@ class DiscussionResource extends JsonResource
             "editor"=> UserApi::getByUuid($this->editor_uid),
             "res_id"=>$this->res_id,
             "res_type"=> $this->res_type,
+            'children_count' => Discussion::where('parent',$this->id)->count(),
             "created_at"=> $this->created_at,
             "updated_at"=> $this->updated_at,
         ];
-        if(empty($this->parent)){
-            $data['children_count'] = Discussion::where('parent',$this->id)->count();
-        }
         return $data;
     }
 }