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