SendSMSJob.php 944 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. namespace App\Jobs;
  3. use Illuminate\Bus\Queueable;
  4. use Illuminate\Queue\SerializesModels;
  5. use Illuminate\Queue\InteractsWithQueue;
  6. use Illuminate\Contracts\Queue\ShouldQueue;
  7. use Illuminate\Foundation\Bus\Dispatchable;
  8. class SendSMSJob implements ShouldQueue
  9. {
  10. use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
  11. protected $mobile = '';
  12. protected $data = '';
  13. protected $template = '';
  14. public $tries = 1;
  15. /**
  16. * Create a new job instance.
  17. *
  18. * @return void
  19. */
  20. public function __construct($mobile, $template, $data)
  21. {
  22. $this->mobile = $mobile;
  23. $this->data = $data;
  24. $this->template = $template;
  25. }
  26. /**
  27. * Execute the job.
  28. *
  29. * @return void
  30. */
  31. public function handle()
  32. {
  33. app('easy_sms')->send($this->mobile, [
  34. 'template' => $this->template,
  35. 'data' => $this->data
  36. ]);
  37. }
  38. }