SendSMSCodeJob.php 623 B

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. namespace App\Jobs;
  3. class SendSMSCodeJob extends Job
  4. {
  5. protected $mobile = '';
  6. protected $code = '';
  7. public $tries = 1;
  8. /**
  9. * Create a new job instance.
  10. *
  11. * @return void
  12. */
  13. public function __construct($mobile, $code)
  14. {
  15. $this->mobile = $mobile;
  16. $this->code = $code;
  17. }
  18. /**
  19. * Execute the job.
  20. *
  21. * @return void
  22. */
  23. public function handle()
  24. {
  25. app('easy_sms')->send($this->mobile, [
  26. 'template' => '1251374',
  27. 'data' => [
  28. 'code' => $this->code
  29. ]
  30. ]);
  31. }
  32. }