3131 */
3232class NavItem implements Stringable
3333{
34- protected ?Route $ destination ;
34+ protected ?Route $ route ;
3535 protected string $ label ;
3636 protected int $ priority ;
3737 protected ?string $ group ;
@@ -57,7 +57,7 @@ public function __construct(Route|string|null $destination, string $label, int $
5757 $ destination = Routes::get ($ destination ) ?? new ExternalRoute ($ destination );
5858 }
5959
60- $ this ->destination = $ destination ;
60+ $ this ->route = $ destination ;
6161 $ this ->label = $ label ;
6262 $ this ->priority = $ priority ;
6363 $ this ->group = static ::normalizeGroupKey ($ group );
@@ -117,16 +117,17 @@ public function __toString(): string
117117 * Get the destination route of the navigation item. For dropdowns, this will return null.
118118 */
119119 public function getDestination(): ?Route
120+ public function getRoute (): ?Route
120121 {
121- return $ this ->destination ;
122+ return $ this ->route ;
122123 }
123124
124125 /**
125126 * Resolve the destination link of the navigation item.
126127 */
127128 public function getLink (): string
128129 {
129- return (string ) $ this ->destination ;
130+ return (string ) $ this ->route ;
130131 }
131132
132133 /**
@@ -144,7 +145,7 @@ public function getLabel(): string
144145 */
145146 public function getPriority (): int
146147 {
147- if ($ this ->hasChildren () && $ this ->children [0 ]->getDestination ()->getPageClass () === DocumentationPage::class) {
148+ if ($ this ->hasChildren () && $ this ->children [0 ]->getRoute ()->getPageClass () === DocumentationPage::class) {
148149 return min ($ this ->priority , collect ($ this ->getChildren ())->min (fn (NavItem $ child ): int => $ child ->getPriority ()));
149150 }
150151
@@ -194,7 +195,7 @@ public function hasChildren(): bool
194195 */
195196 public function isCurrent (): bool
196197 {
197- return Hyde::currentRoute ()->getLink () === $ this ->destination ->getLink ();
198+ return Hyde::currentRoute ()->getLink () === $ this ->route ->getLink ();
198199 }
199200
200201 /**
@@ -207,7 +208,7 @@ public function addChild(NavItem $item): static
207208 $ item ->group ??= $ this ->group ;
208209
209210 $ this ->children [] = $ item ;
210- $ this ->destination = null ;
211+ $ this ->route = null ;
211212
212213 return $ this ;
213214 }
0 commit comments