|
|
- <?php
-
- namespace App\Menus\Nginx;
-
- use PhpSchool\CliMenu\CliMenu;
- use App\Facades\NginxVhost;
- use App\Facades\NginxVhostFactory;
-
- /**
- * @author Aydin Hassan <aydin@hotmail.co.uk>
- */
- class NginxVhostGoBackAction
- {
- // index for vhosts
- const VHOST_INDEX = 0;
-
- /**
- *
- * @param CliMenu $menu [description]
- * @return [type] [description]
- */
- public function __invoke(CliMenu $menu): void
- {
- $parent = $menu->getParent();
- $menu->closeThis();
-
- if ($parent->getParent()) {
- $menu = $parent->getParent();
- } else {
- $menu = $parent;
- }
-
- $menu = NginxVhostFactory::addVhosts($menu, NginxVhost::find(), self::VHOST_INDEX);
- $menu->open();
- }
- }
|