選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

TriggerRecurringInvoiceGeneration.php 951B

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. namespace App\Console\Commands;
  3. use App\Jobs\GenerateRecurringInvoices;
  4. use Illuminate\Console\Command;
  5. class TriggerRecurringInvoiceGeneration extends Command
  6. {
  7. /**
  8. * The name and signature of the console command.
  9. *
  10. * @var string
  11. */
  12. protected $signature = 'invoices:generate-recurring {--queue : Whether the job should be queued}';
  13. /**
  14. * The console command description.
  15. *
  16. * @var string
  17. */
  18. protected $description = 'Generate invoices for active recurring schedules';
  19. /**
  20. * Execute the console command.
  21. */
  22. public function handle(): void
  23. {
  24. if ($this->option('queue')) {
  25. GenerateRecurringInvoices::dispatch();
  26. $this->info('Recurring invoice generation has been queued.');
  27. } else {
  28. GenerateRecurringInvoices::dispatchSync();
  29. $this->info('Recurring invoices have been generated.');
  30. }
  31. }
  32. }