Update.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. namespace App\Console\Commands;
  3. use Illuminate\Console\Command;
  4. class Update extends Command
  5. {
  6. /**
  7. * The name and signature of the console command.
  8. *
  9. * @var string
  10. */
  11. protected $signature = 'chemex:update';
  12. /**
  13. * The console command description.
  14. *
  15. * @var string
  16. */
  17. protected $description = '对Chemex进行升级操作';
  18. /**
  19. * Create a new command instance.
  20. *
  21. * @return void
  22. */
  23. public function __construct()
  24. {
  25. parent::__construct();
  26. }
  27. /**
  28. * Execute the console command.
  29. *
  30. * @return int
  31. */
  32. public function handle(): int
  33. {
  34. $this->call('migrate');
  35. $this->info('数据库迁移完成!');
  36. // 填充菜单
  37. $this->call('db:seed', ['--class' => 'AdminMenuTableSeeder']);
  38. // 填充扩展
  39. $this->call('db:seed', ['--class' => 'AdminExtensionsTableSeeder']);
  40. // 填充扩展历史
  41. $this->call('db:seed', ['--class' => 'AdminExtensionHistoriesTableSeeder']);
  42. // 填充权限
  43. $this->call('db:seed', ['--class' => 'AdminPermissionsTableSeeder']);
  44. // 填充权限-菜单
  45. $this->call('db:seed', ['--class' => 'AdminPermissionMenuTableSeeder']);
  46. $this->info('升级完成!');
  47. return 0;
  48. }
  49. }