styling #350
This commit is contained in:
parent
243d7edaf6
commit
c87756067b
@ -10,50 +10,50 @@ use Symfony\Component\Console\Input\InputArgument;
|
||||
class ModuleDisable extends Command
|
||||
{
|
||||
/**
|
||||
* The console command name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
* The console command name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $name = 'module:disable {alias} {company_id}';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Disable the specified module.';
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*/
|
||||
* Execute the console command.
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$alias = $this->argument('alias');
|
||||
$company_id = $this->argument('company_id');
|
||||
|
||||
$alias = $this->argument('alias');
|
||||
$company_id = $this->argument('company_id');
|
||||
|
||||
$model = Module::alias($alias)->companyId($company_id)->get();
|
||||
|
||||
if (!$model) {
|
||||
$this->info("Module [{$alias}] not found.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!$model) {
|
||||
$this->info("Module [{$alias}] not found.");
|
||||
return;
|
||||
}
|
||||
|
||||
if ($model->enabled == 1) {
|
||||
$model->enabled = 0;
|
||||
$model->save();
|
||||
|
||||
$module = $this->laravel['modules']->findByAlias($alias);
|
||||
|
||||
// Add history
|
||||
$data = [
|
||||
'company_id' => $company_id,
|
||||
'module_id' => $model->id,
|
||||
'category' => $module->get('category'),
|
||||
'version' => $module->get('version'),
|
||||
'description' => trans('modules.disabled', ['module' => $module->get('name')]),
|
||||
];
|
||||
|
||||
ModuleHistory::create($data);
|
||||
$module = $this->laravel['modules']->findByAlias($alias);
|
||||
|
||||
// Add history
|
||||
$data = [
|
||||
'company_id' => $company_id,
|
||||
'module_id' => $model->id,
|
||||
'category' => $module->get('category'),
|
||||
'version' => $module->get('version'),
|
||||
'description' => trans('modules.disabled', ['module' => $module->get('name')]),
|
||||
];
|
||||
|
||||
ModuleHistory::create($data);
|
||||
|
||||
$this->info("Module [{$alias}] disabled.");
|
||||
} else {
|
||||
@ -62,10 +62,10 @@ class ModuleDisable extends Command
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the console command arguments.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
* Get the console command arguments.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getArguments()
|
||||
{
|
||||
return array(
|
||||
|
@ -10,50 +10,50 @@ use Symfony\Component\Console\Input\InputArgument;
|
||||
class ModuleEnable extends Command
|
||||
{
|
||||
/**
|
||||
* The console command name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
* The console command name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $name = 'module:enable {alias} {company_id}';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Enable the specified module.';
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*/
|
||||
* Execute the console command.
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$alias = $this->argument('alias');
|
||||
$company_id = $this->argument('company_id');
|
||||
|
||||
$alias = $this->argument('alias');
|
||||
$company_id = $this->argument('company_id');
|
||||
|
||||
$model = Module::alias($alias)->companyId($company_id)->get();
|
||||
|
||||
if (!$model) {
|
||||
$this->info("Module [{$alias}] not found.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!$model) {
|
||||
$this->info("Module [{$alias}] not found.");
|
||||
return;
|
||||
}
|
||||
|
||||
if ($model->enabled == 0) {
|
||||
$model->enabled = 1;
|
||||
$model->save();
|
||||
|
||||
$module = $this->laravel['modules']->findByAlias($alias);
|
||||
|
||||
// Add history
|
||||
$data = [
|
||||
'company_id' => $company_id,
|
||||
'module_id' => $model->id,
|
||||
'category' => $module->get('category'),
|
||||
'version' => $module->get('version'),
|
||||
'description' => trans('modules.enabled', ['module' => $module->get('name')]),
|
||||
];
|
||||
|
||||
ModuleHistory::create($data);
|
||||
$module = $this->laravel['modules']->findByAlias($alias);
|
||||
|
||||
// Add history
|
||||
$data = [
|
||||
'company_id' => $company_id,
|
||||
'module_id' => $model->id,
|
||||
'category' => $module->get('category'),
|
||||
'version' => $module->get('version'),
|
||||
'description' => trans('modules.enabled', ['module' => $module->get('name')]),
|
||||
];
|
||||
|
||||
ModuleHistory::create($data);
|
||||
|
||||
$this->info("Module [{$alias}] enabled.");
|
||||
} else {
|
||||
@ -62,10 +62,10 @@ class ModuleEnable extends Command
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the console command arguments.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
* Get the console command arguments.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getArguments()
|
||||
{
|
||||
return array(
|
||||
|
@ -64,10 +64,10 @@ class ModuleInstall extends Command
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the console command arguments.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
* Get the console command arguments.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getArguments()
|
||||
{
|
||||
return array(
|
||||
|
Loading…
x
Reference in New Issue
Block a user