ScheduleFinishCommand.php 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <?php
  2. namespace Illuminate\Console\Scheduling;
  3. use Illuminate\Console\Command;
  4. class ScheduleFinishCommand extends Command
  5. {
  6. /**
  7. * The console command name.
  8. *
  9. * @var string
  10. */
  11. protected $signature = 'schedule:finish {id}';
  12. /**
  13. * The console command description.
  14. *
  15. * @var string
  16. */
  17. protected $description = 'Handle the completion of a scheduled command';
  18. /**
  19. * Indicates whether the command should be shown in the Artisan command list.
  20. *
  21. * @var bool
  22. */
  23. protected $hidden = true;
  24. /**
  25. * The schedule instance.
  26. *
  27. * @var \Illuminate\Console\Scheduling\Schedule
  28. */
  29. protected $schedule;
  30. /**
  31. * Create a new command instance.
  32. *
  33. * @param \Illuminate\Console\Scheduling\Schedule $schedule
  34. * @return void
  35. */
  36. public function __construct(Schedule $schedule)
  37. {
  38. $this->schedule = $schedule;
  39. parent::__construct();
  40. }
  41. /**
  42. * Execute the console command.
  43. *
  44. * @return void
  45. */
  46. public function handle()
  47. {
  48. collect($this->schedule->events())->filter(function ($value) {
  49. return $value->mutexName() == $this->argument('id');
  50. })->each->callAfterCallbacks($this->laravel);
  51. }
  52. }