diff --git a/src/Concerns/CanDisableBadges.php b/src/Concerns/CanDisableBadges.php new file mode 100644 index 0000000..adf1d6b --- /dev/null +++ b/src/Concerns/CanDisableBadges.php @@ -0,0 +1,47 @@ +setShowNavigationBadges($show, $resource); + } + + public function showNavigationBadges(Closure | bool $show = true, ?string $resource = null): static + { + return $this->setShowNavigationBadges($show, $resource); + } + + private function setShowNavigationBadges(Closure | bool $show = true, ?string $resource = null): static + { + if ($resource !== null) { + $this->showNavigationBadgesArray[$resource] = $show; + } else { + $this->showNavigationBadges = $show; + } + + return $this; + } + + public function getShowNavigationBadges(?string $resource = null): bool + { + if ($resource !== null) { + return $this->showNavigationBadgesArray[$resource] ?? $this->evaluate($this->showNavigationBadges); + } + + return $this->evaluate($this->showNavigationBadges); + } + + public static function getNavigationBadgesVisibility($resource = null): bool + { + return (new static)::get()->getShowNavigationBadges($resource); + } +}