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 33namespace Native \Laravel \Menu \Items ;
44
55use Native \Laravel \Contracts \MenuItem as MenuItemContract ;
6+ use Native \Laravel \Facades \Menu as MenuFacade ;
7+ use Native \Laravel \Menu \Menu ;
68
79abstract class MenuItem implements MenuItemContract
810{
@@ -18,6 +20,8 @@ abstract class MenuItem implements MenuItemContract
1820
1921 protected ?string $ toolTip = null ;
2022
23+ protected ?Menu $ submenu = null ;
24+
2125 protected bool $ isEnabled = true ;
2226
2327 protected bool $ isVisible = true ;
@@ -80,6 +84,13 @@ public function toolTip(string $toolTip): self
8084 return $ this ;
8185 }
8286
87+ public function submenu (MenuItemContract ...$ items ): self
88+ {
89+ $ this ->submenu = MenuFacade::make (...$ items );
90+
91+ return $ this ;
92+ }
93+
8394 public function toArray (): array
8495 {
8596 return array_filter ([
@@ -92,6 +103,7 @@ public function toArray(): array
92103 'checked ' => $ this ->isChecked ,
93104 'accelerator ' => $ this ->accelerator ,
94105 'icon ' => $ this ->icon ,
106+ 'submenu ' => $ this ->submenu ?->toArray(),
95107 ], fn ($ value ) => $ value !== null );
96108 }
97109}
You can’t perform that action at this time.
0 commit comments