You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

91 lines
1.8 KiB

<?php
namespace App\Commands;
use Illuminate\Console\Scheduling\Schedule;
use LaravelZero\Framework\Commands\Command;
use PhpSchool\CliMenu\Builder\CliMenuBuilder;
use PhpSchool\CliMenu\CliMenu;
class AdminSourcesCommand extends Command
{
/**
* The signature of the command.
*
* @var string
*/
protected $signature = 'admin:sources';
/**
* 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();
}
}