This commit is contained in:
Denis Duliçi 2018-05-21 18:17:54 +03:00
parent 243d7edaf6
commit c87756067b
3 changed files with 72 additions and 72 deletions

View File

@ -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(

View File

@ -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(

View File

@ -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(