DeliveryAppointmentCheck.php 927 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. namespace App\Jobs;
  3. use App\DeliveryAppointment;
  4. use Illuminate\Bus\Queueable;
  5. use Illuminate\Contracts\Queue\ShouldQueue;
  6. use Illuminate\Foundation\Bus\Dispatchable;
  7. use Illuminate\Queue\InteractsWithQueue;
  8. use Illuminate\Queue\SerializesModels;
  9. class DeliveryAppointmentCheck implements ShouldQueue
  10. {
  11. use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
  12. protected $int;
  13. /**
  14. * Create a new job instance.
  15. *
  16. * @param int $int
  17. *
  18. * @return void
  19. */
  20. public function __construct(int $int)
  21. {
  22. $this->int = $int;
  23. }
  24. /**
  25. * Execute the job.
  26. *
  27. * @return void
  28. */
  29. public function handle()
  30. {
  31. /** @var DeliveryAppointment|\stdClass $appointment */
  32. $appointment = DeliveryAppointment::query()->find($this->int);
  33. if ($appointment && $appointment->status!=2)$appointment->update(["status"=>3]);
  34. }
  35. }