修改启用/禁用模块删除对应的菜单
This commit is contained in:
parent
51672734a6
commit
24e1506743
@ -10,6 +10,7 @@
|
|||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
namespace catcher\command\install;
|
namespace catcher\command\install;
|
||||||
|
|
||||||
|
use catchAdmin\permissions\model\Permissions;
|
||||||
use catcher\CatchAdmin;
|
use catcher\CatchAdmin;
|
||||||
use think\console\Command;
|
use think\console\Command;
|
||||||
use think\console\Input;
|
use think\console\Input;
|
||||||
@ -30,11 +31,13 @@ class DisableModuleCommand extends Command
|
|||||||
{
|
{
|
||||||
$module = $input->getArgument('module');
|
$module = $input->getArgument('module');
|
||||||
|
|
||||||
//dd($module, 123);
|
|
||||||
if (empty(CatchAdmin::getModuleInfo(CatchAdmin::directory() .$module))) {
|
if (empty(CatchAdmin::getModuleInfo(CatchAdmin::directory() .$module))) {
|
||||||
$output->error("module [$module] not exist");
|
$output->error("module [$module] not exist");
|
||||||
} else {
|
} else {
|
||||||
CatchAdmin::disableModule($module);
|
CatchAdmin::disableModule($module);
|
||||||
|
Permissions::destroy(function ($query) use ($module){
|
||||||
|
$query->where('module', trim($module));
|
||||||
|
});
|
||||||
$output->info("module [$module] disabled");
|
$output->info("module [$module] disabled");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
namespace catcher\command\install;
|
namespace catcher\command\install;
|
||||||
|
|
||||||
|
use catchAdmin\permissions\model\Permissions;
|
||||||
use catcher\CatchAdmin;
|
use catcher\CatchAdmin;
|
||||||
use think\console\Command;
|
use think\console\Command;
|
||||||
use think\console\Input;
|
use think\console\Input;
|
||||||
@ -33,6 +34,7 @@ class EnableModuleCommand extends Command
|
|||||||
$output->error("module [$module] not exist");
|
$output->error("module [$module] not exist");
|
||||||
} else {
|
} else {
|
||||||
CatchAdmin::enableModule($module);
|
CatchAdmin::enableModule($module);
|
||||||
|
app(Permissions::class)->restore(['module' => trim($module)]);
|
||||||
$output->info("module [$module] enabled");
|
$output->info("module [$module] enabled");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user