Replies: 1 comment
-
I was able to display a submenu by using low-level methods, but I'm losing the advantage of using a wrapper here: use NunoMaduro\LaravelConsoleMenu\MenuOption;
...
$menu = $this->menu("Parent menu");
$menu->addOption(1, 'item 1');
$menu->addSubMenu('item 2', function (CliMenuBuilder $sub) {
$sub->setTitle('Children menu');
$sub->addMenuItem(
new MenuOption(
4,
'sub-item-1',
function (CliMenu $menu) {
$this->result = $menu->getSelectedItem()->getValue();
$menu->close();
}
)
);
$sub->addMenuItem(
new MenuOption(
5,
'sub-item-2',
function (CliMenu $menu) {
$this->result = $menu->getSelectedItem()->getValue();
$menu->close();
}
)
);
});
$menu->addOption(3, 'item 3');
$selected = $menu->open();
$this->info("Selected item: $selected"); Plus I'm not able to get the selected value from the sub-menu. You have successfully used a submenu with laravel-zero + laravel-console-menu + cli-menu ? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello,
I struggle with menus and submenus, I can't figure out how using them.
Here are a few attempts I tried, but none works:
Could you please help me ?
Beta Was this translation helpful? Give feedback.
All reactions