bianjunhui 7 giờ trước cách đây
mục cha
commit
5656048e9e

+ 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,
      * Override the children relationship to target the API resource model,
      * so API Platform can resolve the self-referencing relation.
      * 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()
     public function children()
     {
     {
         return $this->hasMany(self::class, 'parent_id')
         return $this->hasMany(self::class, 'parent_id')
+            ->where('status', 1)
             ->orderBy('sort_order')
             ->orderBy('sort_order')
             ->orderBy('id');
             ->orderBy('id');
     }
     }