You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
1.1 KiB

8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
  1. <?php
  2. namespace App\Console;
  3. use DB;
  4. use Log;
  5. use Illuminate\Console\Scheduling\Schedule;
  6. use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
  7. class Kernel extends ConsoleKernel
  8. {
  9. /**
  10. * 应用提供的Artisan命令
  11. *
  12. * @var array
  13. */
  14. protected $commands = [
  15. Commands\UnpayOrderSetInvalid::class,
  16. Commands\SendEmail::class,
  17. ];
  18. /**
  19. * 定义应用的命令调度
  20. *
  21. * @param \Illuminate\Console\Scheduling\Schedule $schedule
  22. * @return void
  23. */
  24. protected function schedule(Schedule $schedule)
  25. {
  26. Log::info('----Schedule----');
  27. // 使用 command 方法通过命令名或类来调度一个 Artisan 命令
  28. // $schedule->command('unpay_order_set_invalid')->hourly();
  29. // 使用 exec 命令可用于发送命令到操作系统
  30. // $schedule->exec('node /home/forge/script.js')->daily();
  31. }
  32. /**
  33. * Register the Closure based commands for the application.
  34. *
  35. * @return void
  36. */
  37. protected function commands()
  38. {
  39. require base_path('routes/console.php');
  40. }
  41. }