From 785e8677fff88eb62ae34d97c9517b66643defd8 Mon Sep 17 00:00:00 2001 From: wahyuun Date: Wed, 27 Sep 2023 14:57:47 +0700 Subject: [PATCH] change condition Models --- app/Http/Controllers/DivisiController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Controllers/DivisiController.php b/app/Http/Controllers/DivisiController.php index 7ef14d3..e398682 100644 --- a/app/Http/Controllers/DivisiController.php +++ b/app/Http/Controllers/DivisiController.php @@ -92,7 +92,7 @@ class DivisiController extends Controller public function list() { - $parentMenus = Divisi::with('children')->whereNull('parent')->get(); + $parentMenus = Divisi::whereNull('parent')->with('children')->get(); $divisions = []; foreach($parentMenus as $menu){ $childs = $this->getAllChildren($menu);