Skip to content

Commit 0e2429f

Browse files
committed
Add GoToUrl convenience item
1 parent 97bc40b commit 0e2429f

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

src/Menu/Items/GoToUrl.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
3+
namespace Native\Laravel\Menu\Items;
4+
5+
class GoToUrl extends MenuItem
6+
{
7+
public function __construct(
8+
protected string $url,
9+
protected ?string $label = null,
10+
protected ?string $accelerator = null
11+
) {}
12+
13+
public function toArray(): array
14+
{
15+
return array_merge(parent::toArray(), [
16+
'type' => 'goto',
17+
'url' => $this->url,
18+
'label' => $this->label,
19+
]);
20+
}
21+
}

0 commit comments

Comments
 (0)