argument('alias')); $company_id = $this->argument('company_id'); $model = Module::alias($alias)->companyId($company_id)->first(); if (!$model) { $this->info("Module [{$alias}] not found."); return; } if ($model->enabled == 0) { $model->enabled = 1; $model->save(); $module = module($alias); // Add history $data = [ 'company_id' => $company_id, 'module_id' => $model->id, 'category' => $module->get('category', 'payment-method'), 'version' => $module->get('version'), 'description' => trans('modules.enabled', ['module' => $module->get('alias')]), ]; ModuleHistory::create($data); // Trigger event event(new \App\Events\Module\Enabled($alias, $company_id)); $this->info("Module [{$alias}] enabled."); } else { $this->comment("Module [{$alias}] is already enabled."); } } /** * Get the console command arguments. * * @return array */ protected function getArguments() { return array( array('alias', InputArgument::REQUIRED, 'Module alias.'), array('company_id', InputArgument::REQUIRED, 'Company ID.'), ); } }