Skip to content

Commit abb6d72

Browse files
authored
Merge pull request #11 from lara-zeus/hide-resources
add ability to hide a resource
2 parents 68a76eb + 538e242 commit abb6d72

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

src/Configuration.php

+14
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ trait Configuration
1111
*/
1212
protected Closure | string $navigationGroupLabel = 'Pontus';
1313

14+
protected array $hideResources = [];
15+
1416
public function navigationGroupLabel(Closure | string $label): static
1517
{
1618
$this->navigationGroupLabel = $label;
@@ -22,4 +24,16 @@ public function getNavigationGroupLabel(): Closure | string
2224
{
2325
return $this->evaluate($this->navigationGroupLabel);
2426
}
27+
28+
public function hideResources(array $resources): static
29+
{
30+
$this->hideResources = $resources;
31+
32+
return $this;
33+
}
34+
35+
public function getHiddenResources(): ?array
36+
{
37+
return $this->hideResources;
38+
}
2539
}

src/Filament/Resources/PontusResource.php

+5
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,9 @@ public static function getNavigationGroup(): ?string
1111
{
1212
return PontusPlugin::get()->getNavigationGroupLabel();
1313
}
14+
15+
public static function shouldRegisterNavigation(): bool
16+
{
17+
return ! in_array(static::class, PontusPlugin::get()->getHiddenResources());
18+
}
1419
}

0 commit comments

Comments
 (0)