FormatMenuPath.php 995 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. declare (strict_types=1);
  3. namespace app\command;
  4. use app\common\repositories\system\auth\MenuRepository;
  5. use think\console\Command;
  6. use think\console\Input;
  7. use think\console\Output;
  8. /**
  9. * Class FormatMenuPath
  10. * @package app\command
  11. * @author xaboy
  12. * @day 2020/8/26
  13. */
  14. class FormatMenuPath extends Command
  15. {
  16. /**
  17. * @author xaboy
  18. * @day 2020/8/26
  19. */
  20. protected function configure()
  21. {
  22. // 指令配置
  23. $this->setName('menu:format')
  24. ->setDescription('the format menu command');
  25. }
  26. /**
  27. * @param Input $input
  28. * @param Output $output
  29. * @return int|void|null
  30. * @author xaboy
  31. * @day 2020/8/26
  32. */
  33. protected function execute(Input $input, Output $output)
  34. {
  35. $output->writeln('开启修复');
  36. $menuRepository = app()->make(MenuRepository::class);
  37. $menuRepository->formatPath(0);
  38. $menuRepository->formatPath(1);
  39. $output->writeln('执行成功');
  40. }
  41. }