receipt_issuing_order_id = $receiptIssuingOrder->id; $order->contract_id = $receiptIssuingOrder->contract_id; $order->phone_number = $receiptIssuingOrder->sms_phone_number; $order->summary_key1 = $receiptIssuingOrder->summary_key1; $order->summary_key2 = $receiptIssuingOrder->summary_key2; $order->purpose = $purpose; $order->content = $contents; $order->sms_provider_id = static::getMst()->id; return $order; } public function __construct( private SMSSendOrder $order, ) { } public function loadOrder(string $id): static { $this->order = SMSSendOrder::findOrFail($id); return $this; } public function setOrder(SMSSendOrder $order): static { $this->order = $order; return $this; } public function getOrder() { return $this->order; } public function send(): bool { $this->order->send_datetime = DateUtil::now(); $this->order->done = true; $this->order->save(); info(sprintf("SMS送信ダミー:<<%s>>", $this->order->content)); return true; } public function poll(): bool { return true; } public function cancel(): bool { return true; } private static function getMst(): SMSProvider { static $provider = null; if ($provider === null) { $provider = SMSProvider::whereProviderName(SMSProviderName::LOG->value) ->firstOrFail(); } return $provider; } }