FormatMenuPath.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2024 https://www.crmeb.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  8. // +----------------------------------------------------------------------
  9. // | Author: CRMEB Team <admin@crmeb.com>
  10. // +----------------------------------------------------------------------
  11. declare (strict_types=1);
  12. namespace app\command;
  13. use app\common\repositories\system\auth\MenuRepository;
  14. use think\console\Command;
  15. use think\console\Input;
  16. use think\console\Output;
  17. /**
  18. * Class FormatMenuPath
  19. * @package app\command
  20. * @author xaboy
  21. * @day 2020/8/26
  22. */
  23. class FormatMenuPath extends Command
  24. {
  25. /**
  26. * @author xaboy
  27. * @day 2020/8/26
  28. */
  29. protected function configure()
  30. {
  31. // 指令配置
  32. $this->setName('menu:format')
  33. ->setDescription('the format menu command');
  34. }
  35. /**
  36. * 修复菜单路径
  37. * @param Input $input
  38. * @param Output $output
  39. * @return int|void|null
  40. * @author xaboy
  41. * @day 2020/8/26
  42. */
  43. protected function execute(Input $input, Output $output)
  44. {
  45. $output->writeln('开启修复');
  46. $menuRepository = app()->make(MenuRepository::class);
  47. $menuRepository->formatPath(0);
  48. $menuRepository->formatPath(1);
  49. $output->writeln('执行成功');
  50. }
  51. }