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.

41 lines
882 B

  1. <?php
  2. namespace App\Utilities\Jobs;
  3. use App\Jobs\Job;
  4. class AsyncCall extends Job
  5. {
  6. private string $method;
  7. private string $service;
  8. private string $path;
  9. private array $data;
  10. /**
  11. * AsyncCall constructor.
  12. * @param string $method
  13. * @param string $service
  14. * @param string $path
  15. * @param array $data
  16. * @param string $queue
  17. */
  18. public function __construct(string $method, string $service, string $path, array $data, string $queue)
  19. {
  20. $this->method = $method;
  21. $this->service = $service;
  22. $this->path = $path;
  23. $this->data = $data;
  24. $this->onQueue($queue);
  25. $this->onConnection('database');
  26. }
  27. /**
  28. * Execute the job.
  29. *
  30. * @return void
  31. */
  32. public function handle()
  33. {
  34. call($this->method, $this->service, $this->path, $this->data);
  35. }
  36. }