diff --git a/src/Configuration.php b/src/Configuration.php index 916f77da..dbfcdcae 100644 --- a/src/Configuration.php +++ b/src/Configuration.php @@ -250,7 +250,7 @@ public function showNavigationBadges(Closure | bool $show = true, ?Resources $re private function setShowNavigationBadges(Closure | bool $show = true, ?Resources $resource = null): static { - if (! is_null($resource)) { + if ($resource !== null) { $this->showNavigationBadgesArray[$resource->value] = $show; } else { $this->showNavigationBadges = $show; @@ -261,14 +261,14 @@ private function setShowNavigationBadges(Closure | bool $show = true, ?Resources public function getShowNavigationBadges(?Resources $resource = null): bool { - if (! is_null($resource)) { + if ($resource !== null) { return $this->showNavigationBadgesArray[$resource->value] ?? $this->evaluate($this->showNavigationBadges); } return $this->evaluate($this->showNavigationBadges); } - public static function getShowOrHideNavigationBadges(?Resources $resource = null): bool + public static function getNavigationBadgesVisibility(?Resources $resource = null): bool { return (new static())::get()->getShowNavigationBadges($resource); } diff --git a/src/Enums/Resources.php b/src/Enums/Resources.php index b4c8e60e..1b075644 100644 --- a/src/Enums/Resources.php +++ b/src/Enums/Resources.php @@ -5,6 +5,8 @@ enum Resources: string { case CategoryResource = 'CategoryResource'; + case CollectionResource = 'CollectionResource'; + case FormResource = 'FormResource'; } diff --git a/src/Filament/Resources/CategoryResource.php b/src/Filament/Resources/CategoryResource.php index 64c59956..a5e75364 100644 --- a/src/Filament/Resources/CategoryResource.php +++ b/src/Filament/Resources/CategoryResource.php @@ -48,7 +48,7 @@ public static function getModel(): string public static function getNavigationBadge(): ?string { - if (! BoltPlugin::getShowOrHideNavigationBadges(Resources::CategoryResource)) { + if (! BoltPlugin::getNavigationBadgesVisibility(Resources::CategoryResource)) { return null; } diff --git a/src/Filament/Resources/CollectionResource.php b/src/Filament/Resources/CollectionResource.php index 2c809a57..79582062 100644 --- a/src/Filament/Resources/CollectionResource.php +++ b/src/Filament/Resources/CollectionResource.php @@ -33,7 +33,7 @@ public static function getModel(): string public static function getNavigationBadge(): ?string { - if (! BoltPlugin::getShowOrHideNavigationBadges(Resources::CollectionResource)) { + if (! BoltPlugin::getNavigationBadgesVisibility(Resources::CollectionResource)) { return null; } diff --git a/src/Filament/Resources/FormResource.php b/src/Filament/Resources/FormResource.php index d29c92c0..5d825c5d 100644 --- a/src/Filament/Resources/FormResource.php +++ b/src/Filament/Resources/FormResource.php @@ -58,7 +58,7 @@ public static function getModel(): string public static function getNavigationBadge(): ?string { - if (! BoltPlugin::getShowOrHideNavigationBadges(Resources::FormResource)) { + if (! BoltPlugin::getNavigationBadgesVisibility(Resources::FormResource)) { return null; }