|
|
- <?php
-
- namespace App\Commands;
-
- use Illuminate\Console\Scheduling\Schedule;
- use LaravelZero\Framework\Commands\Command;
-
- use PhpSchool\CliMenu\Builder\CliMenuBuilder;
- use PhpSchool\CliMenu\CliMenu;
-
- class AdminLogsCommand extends Command
- {
- /**
- * The signature of the command.
- *
- * @var string
- */
- protected $signature = 'admin:logs';
-
- /**
- * The description of the command.
- *
- * @var string
- */
- protected $description = 'Command description';
-
- /**
- *
- *
- */
- private function addInputItem()
- {
- $callable = function(CliMenu $menu)
- {
- $input = $menu->askText();
- $result = $input->ask();
-
- $menu->redraw();
- };
-
- return $callable;
- }
-
- /**
- *
- *
- */
- private function addCreateItem()
- {
- $menu = function(CliMenuBuilder $builder)
- {
- $data = [];
-
- $builder
- ->setTitle('Settings > Add')
- ->disableDefaultItems()
-
- // input name
- ->addItem('name', $this->addInputItem())
-
- // input url
- ->addItem('url', $this->addInputItem())
- ->addItem('handler', $this->addInputItem())
-
- ->addLineBreak('-')
- ->addSubMenu('actions', $this->addActions())
-
- ->addLineBreak('-');
- };
-
- return $menu;
- }
-
- /**
- * Execute the console command.
- *
- * @return mixed
- */
- public function handle()
- {
- // create menu
- $builder = $this->menu('Settings');
-
- $builder
- ->addSubMenu('Add', $this->addCreateItem())
- ->addLineBreak('-');
-
- $mainmenu = $builder->build();
- $mainmenu->open();
- }
- }
|