bianjunhui 15 часов назад
Родитель
Сommit
5656048e9e
1 измененных файлов с 5 добавлено и 0 удалено
  1. 5 0
      packages/Webkul/BagistoApi/src/Models/FrontMenuItem.php

+ 5 - 0
packages/Webkul/BagistoApi/src/Models/FrontMenuItem.php

@@ -59,10 +59,15 @@ class FrontMenuItem extends BaseFrontMenuItem
     /**
      * Override the children relationship to target the API resource model,
      * so API Platform can resolve the self-referencing relation.
+     *
+     * Disabled (status = 0) children are excluded by default so they are
+     * never surfaced through the API, regardless of which field accesses
+     * the relation.
      */
     public function children()
     {
         return $this->hasMany(self::class, 'parent_id')
+            ->where('status', 1)
             ->orderBy('sort_order')
             ->orderBy('id');
     }