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.

123456789101112131415161718192021222324
  1. <?php
  2. namespace App\Jobs;
  3. use App\Enums\Accounting\InvoiceStatus;
  4. use App\Models\Accounting\Invoice;
  5. use Illuminate\Contracts\Queue\ShouldQueue;
  6. use Illuminate\Foundation\Queue\Queueable;
  7. class ProcessOverdueInvoices implements ShouldQueue
  8. {
  9. use Queueable;
  10. /**
  11. * Execute the job.
  12. */
  13. public function handle(): void
  14. {
  15. Invoice::query()
  16. ->whereIn('status', InvoiceStatus::canBeOverdue())
  17. ->where('due_date', '<', today())
  18. ->update(['status' => InvoiceStatus::Overdue]);
  19. }
  20. }