From 18c5102722f8e34796efbe330dc593469f6e8cc3 Mon Sep 17 00:00:00 2001 From: wahyuun Date: Mon, 25 Sep 2023 14:16:17 +0700 Subject: [PATCH] change position eloquent in list method --- 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 a7d3617..17ad122 100644 --- a/app/Http/Controllers/DivisiController.php +++ b/app/Http/Controllers/DivisiController.php @@ -91,7 +91,7 @@ class DivisiController extends Controller public function list() { - $parentMenus = Divisi::whereNull('parent')->with('children')->get(); + $parentMenus = Divisi::with('children')->whereNull('parent')->get(); $divisions = []; foreach($parentMenus as $menu){ $childs = $this->getAllChildren($menu);