SendSMSJob.php 919 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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. /**
  15. * Create a new job instance.
  16. *
  17. * @return void
  18. */
  19. public function __construct($mobile,$template, $data)
  20. {
  21. $this->mobile = $mobile;
  22. $this->data = $data;
  23. $this->template = $template;
  24. }
  25. /**
  26. * Execute the job.
  27. *
  28. * @return void
  29. */
  30. public function handle()
  31. {
  32. app('easy_sms')->send($this->mobile, [
  33. 'template' => $this->template,
  34. 'data' => $this->data
  35. ]);
  36. }
  37. }