Kernel.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. Commands\AskAndEchoCommand::class,
  21. ];
  22. /**
  23. * Define the application's command schedule.
  24. *
  25. * These schedules are run in a single process, so avoid doing any heavy processing here.
  26. *
  27. * @param \Illuminate\Console\Scheduling\Schedule $schedule
  28. * @return void
  29. */
  30. protected function schedule(Schedule $schedule): void
  31. {
  32. // 命令调度不是写在这里!
  33. // 调度写在 routes/console.php 中
  34. }
  35. /**
  36. * Register the commands for the application.
  37. *
  38. * @return void
  39. */
  40. protected function commands(): void
  41. {
  42. $this->load(__DIR__.'/Commands');
  43. require base_path('routes/console.php');
  44. }
  45. }