@@ -32,10 +32,11 @@ class NavigationItem implements Stringable
3232 * @param \Hyde\Support\Models\Route|string<\Hyde\Support\Models\RouteKey>|string $destination Route instance or route key, or an external URI.
3333 * @param string|null $label If not provided, Hyde will try to get it from the route's connected page, or from the URL.
3434 * @param int|null $priority If not provided, Hyde will try to get it from the route or the default priority of 500.
35+ * @param array<string, scalar> $attributes Additional attributes for the navigation item.
3536 */
36- public function __construct (Route |string $ destination , ?string $ label = null , ?int $ priority = null )
37+ public function __construct (Route |string $ destination , ?string $ label = null , ?int $ priority = null , array $ attributes = [] )
3738 {
38- [$ this ->destination , $ this ->label , $ this ->priority ] = self ::make ($ destination , $ label , $ priority );
39+ [$ this ->destination , $ this ->label , $ this ->priority , $ this -> attributes ] = self ::make ($ destination , $ label , $ priority, $ attributes );
3940 }
4041
4142 /**
@@ -44,10 +45,11 @@ public function __construct(Route|string $destination, ?string $label = null, ?i
4445 * @param \Hyde\Support\Models\Route|string<\Hyde\Support\Models\RouteKey>|string $destination Route instance or route key, or an external URI.
4546 * @param string|null $label If not provided, Hyde will try to get it from the route's connected page, or from the URL.
4647 * @param int|null $priority If not provided, Hyde will try to get it from the route or the default priority of 500.
48+ * @param array<string, scalar> $attributes Additional attributes for the navigation item.
4749 */
48- public static function create (Route |string $ destination , ?string $ label = null , ?int $ priority = null ): static
50+ public static function create (Route |string $ destination , ?string $ label = null , ?int $ priority = null , array $ attributes = [] ): static
4951 {
50- return new static (...self ::make ($ destination , $ label , $ priority ));
52+ return new static (...self ::make ($ destination , $ label , $ priority, $ attributes ));
5153 }
5254
5355 /**
0 commit comments