From 8c78ab69d0a44cf51dea732ce7db84e643017871 Mon Sep 17 00:00:00 2001 From: farhan048 Date: Tue, 4 Apr 2023 14:06:34 +0700 Subject: [PATCH] add gant to tree --- app/Http/Controllers/HierarchyFtthController.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/Http/Controllers/HierarchyFtthController.php b/app/Http/Controllers/HierarchyFtthController.php index 1184109..2953325 100644 --- a/app/Http/Controllers/HierarchyFtthController.php +++ b/app/Http/Controllers/HierarchyFtthController.php @@ -4,6 +4,7 @@ namespace App\Http\Controllers; use Illuminate\Http\Request; use App\Models\HierarchyFtth; +use App\Models\VersionGantt; class HierarchyFtthController extends Controller { @@ -115,7 +116,12 @@ class HierarchyFtthController extends Controller { $finalData = []; $data = HierarchyFtth::where('project_id', $project_id)->where('parent_id', $parent_id)->orderByRaw('id ASC')->get(); + foreach($data as $objRow){ + if (VersionGantt::where('hierarchy_ftth_id', $objRow->id)->exists()) { + $dataGantt = VersionGantt::where('hierarchy_ftth_id', $objRow->id)->get(); + $objRow->dataGantt = $dataGantt; + } $objRow->key = rand(1, 1000); $objRow->children = $this->getChildren($project_id, $objRow->id); $finalData[] = $objRow;