Kernel.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. namespace App\Console;
  3. use Illuminate\Console\Scheduling\Schedule;
  4. use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
  5. /**
  6. * 控制台内核类
  7. *
  8. * 负责注册 Artisan 命令和定义命令调度,继承自 Laravel 的控制台内核
  9. */
  10. class Kernel extends ConsoleKernel
  11. {
  12. /**
  13. * The Artisan commands provided by your application.
  14. *
  15. * @var array
  16. */
  17. protected $commands = [
  18. Commands\DisabledMigrateCommand::class,
  19. Commands\DisabledBaseMigrateCommand::class,
  20. ];
  21. /**
  22. * Define the application's command schedule.
  23. *
  24. * These schedules are run in a single process, so avoid doing any heavy processing here.
  25. *
  26. * @param \Illuminate\Console\Scheduling\Schedule $schedule
  27. * @return void
  28. */
  29. protected function schedule(Schedule $schedule): void
  30. {
  31. // 命令调度不是写在这里!
  32. // 调度写在 routes/console.php 中
  33. }
  34. /**
  35. * Register the commands for the application.
  36. *
  37. * @return void
  38. */
  39. protected function commands(): void
  40. {
  41. $this->load(__DIR__.'/Commands');
  42. require base_path('routes/console.php');
  43. }
  44. }