From 32973bb8893a54fec755a79eaae8ffa85684e47b Mon Sep 17 00:00:00 2001 From: Ash Monsh Date: Wed, 18 Oct 2023 19:52:37 +0300 Subject: [PATCH] allow to hide tag resource --- src/Configuration.php | 14 ++++++++++++++ src/SkyPlugin.php | 4 +++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/Configuration.php b/src/Configuration.php index 615725c..0a20ce2 100644 --- a/src/Configuration.php +++ b/src/Configuration.php @@ -123,6 +123,8 @@ trait Configuration protected bool $hasLibraryResource = true; + protected bool $hasTagResource = true; + /* * @deprecated deprecated since version 3.2 */ @@ -389,6 +391,18 @@ public function hasLibraryResource(): bool return $this->hasLibraryResource; } + public function tagResource(bool $condition = true): static + { + $this->hasTagResource = $condition; + + return $this; + } + + public function hasTagResource(): bool + { + return $this->hasTagResource; + } + public function libraryTypes(array $types): static { $this->libraryTypes = $types; diff --git a/src/SkyPlugin.php b/src/SkyPlugin.php index 7595e94..7763077 100644 --- a/src/SkyPlugin.php +++ b/src/SkyPlugin.php @@ -39,7 +39,9 @@ public function register(Panel $panel): void $panel->resources([LibraryResource::class]); } - $panel->resources([TagResource::class]); + if ($this->hasTagResource()) { + $panel->resources([TagResource::class]); + } } public static function make(): static