jqh 4 years ago
parent
commit
3af804f738
2 changed files with 14 additions and 5 deletions
  1. 9 5
      src/Form/Builder.php
  2. 5 0
      src/Form/Concerns/HasTabs.php

+ 9 - 5
src/Form/Builder.php

@@ -813,12 +813,16 @@ class Builder
         };
 
         $this->fields = $this->fields()->reject($reject);
-        
-        $this->form->getTab()->getTabs()->transform(function($item) use ($reject) {
-            $item['fields'] = $item['fields']->reject($reject);
 
-            return $item;
-        });
+        if ($this->form->hasTab()) {
+            $this->form->getTab()->getTabs()->transform(function($item) use ($reject) {
+                if (! empty($item['fields'])) {
+                    $item['fields'] = $item['fields']->reject($reject);
+                }
+
+                return $item;
+            });
+        }
     }
 
     /**

+ 5 - 0
src/Form/Concerns/HasTabs.php

@@ -27,6 +27,11 @@ trait HasTabs
         return $this;
     }
 
+    public function hasTab()
+    {
+        return $this->tab ? true : false;
+    }
+
     /**
      * Get Tab instance.
      *