|
@ -13,6 +13,7 @@ use App\Facades\TerminalHelper; |
|
|
use App\Facades\Menus\StylesFactory; |
|
|
use App\Facades\Menus\StylesFactory; |
|
|
|
|
|
|
|
|
use App\Helpers\NginxTemplateHelper; |
|
|
use App\Helpers\NginxTemplateHelper; |
|
|
|
|
|
use App\Menus\Nginx\NginxVhostGoBackAction; |
|
|
|
|
|
|
|
|
use App\BladeFile; |
|
|
use App\BladeFile; |
|
|
|
|
|
|
|
@ -161,7 +162,7 @@ class NginxVhostsCommand extends Command |
|
|
$file = str_replace('.service', '', $file); |
|
|
$file = str_replace('.service', '', $file); |
|
|
|
|
|
|
|
|
$builder->addRadioItem($file, function(CliMenu $menu) use (&$configuration) { |
|
|
$builder->addRadioItem($file, function(CliMenu $menu) use (&$configuration) { |
|
|
$configuration['php_fpm'] = $menu->getSelectedItem()->getText(); |
|
|
|
|
|
|
|
|
$configuration['phpFpm'] = $menu->getSelectedItem()->getText(); |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -184,7 +185,7 @@ class NginxVhostsCommand extends Command |
|
|
$validator = v::key('domain', v::domain(false)) |
|
|
$validator = v::key('domain', v::domain(false)) |
|
|
->key('root', v::directory()) |
|
|
->key('root', v::directory()) |
|
|
->key('index', v::file()) |
|
|
->key('index', v::file()) |
|
|
->key('php_fpm', v::notEmpty()); |
|
|
|
|
|
|
|
|
->key('phpFpm', v::notEmpty()); |
|
|
|
|
|
|
|
|
try { |
|
|
try { |
|
|
$validator->assert($data); |
|
|
$validator->assert($data); |
|
@ -201,17 +202,11 @@ class NginxVhostsCommand extends Command |
|
|
|
|
|
|
|
|
// write configuration to file
|
|
|
// write configuration to file
|
|
|
$bladeFile->put($template['name'], '/etc/nginx/sites-available/'.$filename, $configuration); |
|
|
$bladeFile->put($template['name'], '/etc/nginx/sites-available/'.$filename, $configuration); |
|
|
|
|
|
|
|
|
$menu->confirm('Success!')->display('Ok!'); |
|
|
$menu->confirm('Success!')->display('Ok!'); |
|
|
|
|
|
|
|
|
// prepare for close current submenu and open mainmenu
|
|
|
|
|
|
$parent = $menu->getParent(); |
|
|
|
|
|
$menu->closeThis(); |
|
|
|
|
|
|
|
|
|
|
|
$mainmenu = $parent->getParent(); |
|
|
|
|
|
|
|
|
|
|
|
$mainmenu = NginxVhostFactory::addVhosts($mainmenu, NginxVhost::find(), self::VHOST_INDEX); |
|
|
|
|
|
$mainmenu->open(); |
|
|
|
|
|
|
|
|
// invoke action
|
|
|
|
|
|
$action = new NginxVhostGoBackAction(); |
|
|
|
|
|
is_callable($action($menu)); |
|
|
} |
|
|
} |
|
|
}) |
|
|
}) |
|
|
->addLineBreak('-'); |
|
|
->addLineBreak('-'); |
|
|