File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change 3
3
namespace Native \Laravel \Menu \Items ;
4
4
5
5
use Native \Laravel \Contracts \MenuItem as MenuItemContract ;
6
+ use Native \Laravel \Facades \Menu as MenuFacade ;
7
+ use Native \Laravel \Menu \Menu ;
6
8
7
9
abstract class MenuItem implements MenuItemContract
8
10
{
@@ -18,6 +20,8 @@ abstract class MenuItem implements MenuItemContract
18
20
19
21
protected ?string $ toolTip = null ;
20
22
23
+ protected ?Menu $ submenu = null ;
24
+
21
25
protected bool $ isEnabled = true ;
22
26
23
27
protected bool $ isVisible = true ;
@@ -80,6 +84,13 @@ public function toolTip(string $toolTip): self
80
84
return $ this ;
81
85
}
82
86
87
+ public function submenu (MenuItemContract ...$ items ): self
88
+ {
89
+ $ this ->submenu = MenuFacade::make (...$ items );
90
+
91
+ return $ this ;
92
+ }
93
+
83
94
public function toArray (): array
84
95
{
85
96
return array_filter ([
@@ -92,6 +103,7 @@ public function toArray(): array
92
103
'checked ' => $ this ->isChecked ,
93
104
'accelerator ' => $ this ->accelerator ,
94
105
'icon ' => $ this ->icon ,
106
+ 'submenu ' => $ this ->submenu ?->toArray(),
95
107
], fn ($ value ) => $ value !== null );
96
108
}
97
109
}
You can’t perform that action at this time.
0 commit comments