Skip to content

Commit

Permalink
hidden navigation method.
Browse files Browse the repository at this point in the history
  • Loading branch information
thisnugroho authored Aug 12, 2023
1 parent e75ef9b commit 0af849c
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/Navigation/NavigationItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ class NavigationItem
protected ?int $sort = null;

protected ?string $route = null;


protected bool | Closure | null $hidden = null;

public function __construct()
{
}
Expand Down Expand Up @@ -180,4 +182,18 @@ public function isActive(): bool

return app()->call($callback);
}

public function hidden(bool | Closure | null $isHidden = null): static
{
$this->hidden = $isHidden;
return $this;
}

public function isHidden(): ?bool
{
if($this->hidden instanceof Closure) {
return app()->call($this->hidden);
}
return $this->hidden;
}
}

0 comments on commit 0af849c

Please sign in to comment.