UserTaskJob.php 950 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. namespace App\Jobs;
  3. use App\Modules\UserTask\Services\UserTaskService;
  4. use Illuminate\Bus\Queueable;
  5. use Illuminate\Queue\SerializesModels;
  6. use Illuminate\Queue\InteractsWithQueue;
  7. use Illuminate\Contracts\Queue\ShouldQueue;
  8. use Illuminate\Foundation\Bus\Dispatchable;
  9. class UserTaskJob implements ShouldQueue
  10. {
  11. use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
  12. private $uid;
  13. private $type;
  14. private $trigger_type;
  15. /**
  16. * Create a new job instance.
  17. *
  18. * @return void
  19. */
  20. public function __construct(int $uid, string $type, string $trigger_type)
  21. {
  22. $this->uid = $uid;
  23. $this->type = $type;
  24. $this->trigger_type = $trigger_type;
  25. }
  26. /**
  27. * Execute the job.
  28. *
  29. * @return void
  30. */
  31. public function handle()
  32. {
  33. $service = new UserTaskService($this->uid);
  34. $service->trigger($this->type, $this->trigger_type);
  35. }
  36. }