From fbd47492d8ac25b82931137b8a4bbeb86d31b445 Mon Sep 17 00:00:00 2001 From: A1Gard Date: Tue, 25 Mar 2025 14:24:56 +0330 Subject: [PATCH] optimized code to models don't have parent-child --- app/Helpers/Helper.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/Helpers/Helper.php b/app/Helpers/Helper.php index 930185c..319bebe 100644 --- a/app/Helpers/Helper.php +++ b/app/Helpers/Helper.php @@ -726,7 +726,9 @@ function nestedWithData($items, $parent_id = null) if ($item->parent_id == $parent_id) { $name = $item->name ?? $item->title ?? $item->id; $r .= "
  • {$name}" . PHP_EOL; - $r .= nestedWithData($items, $item->id); + if ($item->hasAttribute('parent_id')) { + $r .= nestedWithData($items, $item->id); + } $r .= PHP_EOL . '
  • '; } }