領収証発行サービス
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.

50 line
1.1KB

  1. <?php
  2. namespace App\Jobs\SMS;
  3. use App\Codes\QueueName;
  4. use App\Logic\SMS\SMSManager;
  5. use App\Models\SMSSendOrder;
  6. use Illuminate\Bus\Queueable;
  7. use Illuminate\Contracts\Queue\ShouldQueue;
  8. use Illuminate\Foundation\Bus\Dispatchable;
  9. use Illuminate\Queue\InteractsWithQueue;
  10. use Illuminate\Queue\SerializesModels;
  11. class SendSMS implements ShouldQueue
  12. {
  13. use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
  14. /**
  15. * Create a new job instance.
  16. *
  17. * @return void
  18. */
  19. public function __construct(private SMSSendOrder $order)
  20. {
  21. $this->onQueue(QueueName::SMS->value);
  22. }
  23. /**
  24. * Execute the job.
  25. *
  26. * @return void
  27. */
  28. public function handle(SMSManager $manager)
  29. {
  30. $ret = $manager->setOrder($this->order)
  31. ->send();
  32. if ($ret) {
  33. info(sprintf(
  34. "SMS送信依頼成功 address:%s order_id:%s",
  35. $this->order->phone_number,
  36. $this->order->id,
  37. ));
  38. } else {
  39. $this->fail(sprintf("SMS送信依頼失敗 order_id:%s", $this->order->id));
  40. }
  41. }
  42. }