Repository URL to install this package:
|
Version:
1.0.0 ▾
|
<?php
/**
* Created by PhpStorm.
* User: danilo
* Date: 18/12/15
* Time: 10:58
*/
namespace Modules\Core\Commands\Installers\Scripts;
use Illuminate\Console\Command;
use Modules\Core\Commands\Installers\SetupScript;
abstract class ModuleCommand implements SetupScript
{
/**
* @var array
*/
protected $modules = [
'Core',
'Themes',
'Dashboard',
'Menu',
];
public function __construct()
{
$this->modules = \Module::enabled();
if (($key = array_search('Users', $this->modules)) !== false) {
unset($this->modules[$key]);
}
}
/**
* Fire the install script
* @param Command $command
* @return mixed
*/
public function fire(Command $command)
{
$commandName = $this->getCommand();
$command->blockMessage(ucfirst($commandName), 'Running the module ' . $commandName . ' ...', 'comment');
foreach ($this->modules as $module) {
if ($command->option('verbose')) {
$command->call('module:' . $commandName, ['module' => (string)$module]);
continue;
}
$command->callSilent('module:' . $commandName, ['module' => (string)$module]);
}
}
/**
* @return string command name. ex: seed
*/
abstract protected function getCommand();
}