修改启用/禁用模块删除对应的菜单

This commit is contained in:
JaguarJack 2020-07-01 15:47:06 +08:00
parent 51672734a6
commit 24e1506743
2 changed files with 6 additions and 1 deletions

View File

@ -10,6 +10,7 @@
// +----------------------------------------------------------------------
namespace catcher\command\install;
use catchAdmin\permissions\model\Permissions;
use catcher\CatchAdmin;
use think\console\Command;
use think\console\Input;
@ -30,11 +31,13 @@ class DisableModuleCommand extends Command
{
$module = $input->getArgument('module');
//dd($module, 123);
if (empty(CatchAdmin::getModuleInfo(CatchAdmin::directory() .$module))) {
$output->error("module [$module] not exist");
} else {
CatchAdmin::disableModule($module);
Permissions::destroy(function ($query) use ($module){
$query->where('module', trim($module));
});
$output->info("module [$module] disabled");
}
}

View File

@ -10,6 +10,7 @@
// +----------------------------------------------------------------------
namespace catcher\command\install;
use catchAdmin\permissions\model\Permissions;
use catcher\CatchAdmin;
use think\console\Command;
use think\console\Input;
@ -33,6 +34,7 @@ class EnableModuleCommand extends Command
$output->error("module [$module] not exist");
} else {
CatchAdmin::enableModule($module);
app(Permissions::class)->restore(['module' => trim($module)]);
$output->info("module [$module] enabled");
}
}