diff --git a/app/Http/Controllers/HierarchyFtthController.php b/app/Http/Controllers/HierarchyFtthController.php index 2953325..b29d298 100644 --- a/app/Http/Controllers/HierarchyFtthController.php +++ b/app/Http/Controllers/HierarchyFtthController.php @@ -118,11 +118,14 @@ class HierarchyFtthController extends Controller $data = HierarchyFtth::where('project_id', $project_id)->where('parent_id', $parent_id)->orderByRaw('id ASC')->get(); foreach($data as $objRow){ + $objRow->key = rand(1, 1000); if (VersionGantt::where('hierarchy_ftth_id', $objRow->id)->exists()) { $dataGantt = VersionGantt::where('hierarchy_ftth_id', $objRow->id)->get(); + foreach ($dataGantt as $gantt) { + $gantt->key = $objRow->key; + } $objRow->dataGantt = $dataGantt; } - $objRow->key = rand(1, 1000); $objRow->children = $this->getChildren($project_id, $objRow->id); $finalData[] = $objRow; }