diff --git a/src/Traits/HasTabs.php b/src/Traits/HasTabs.php index 6839b0e..317fb52 100644 --- a/src/Traits/HasTabs.php +++ b/src/Traits/HasTabs.php @@ -97,7 +97,21 @@ protected function panelsWithDefaultLabel(Collection $panels, FieldCollection $f : $panels; }) ->tap(function ($panels) use ($label): void { - $panels->where('component', 'tabs')->isEmpty() ? $panels->where('component', 'tabs')->first() : $panels->first()->withToolbar(); + + /** + * There can be no panels + * Preventing ->component or ->withToolbar() on null error + */ + if(!$panels->first()){ + return; + } + + /** + * Default to ->withToolbar() if the first panel is not a Tabs + * Otherwise, we show the tabs component with the settings configured within it + * This check is necessary in case you ARE using Tabs component, but only for relation as a 2nd or 3rd instance + */ + $panels->first()->component !== 'tabs' ? $panels->first()->withToolbar() : $panels->where('component', 'tabs')->first(); }); } }