order; $this->initialized = true; return $this; } public function id(): string { return $this->order->id ?? ""; } public function fill(array $attr) { $this->order->fill($attr); return $this; } public function create(): array { $order = $this->order; // パラメータチェック $messages = $this->paramCheck(); if (count($messages) !== 0) { return $messages; } // モデル更新 $order->order_datetime = DateUtil::now(); $this->refreshToken(); $contractId = $this->loginUser()->getCurrentContractId(); if ($contractId === null) { throw new LogicException("契約不良"); } $order->setContract($contractId); $this->save(); // SMS配信 $smsSendOrder = $this->smsManager::makeSMSSendOrder($order, SMSSendPurpose::SEND_RECEIPT_ISSUING_ORDER_FORM, $this->makeSMSContents()); $smsSendOrder->send(); return []; } private function paramCheck(): array { $ret = []; $order = $this->order; return $ret; } private function makeSMSContents(): string { $url = ""; if (app()->environment(EnvironmentName::LOCAL->value)) { // localhostのURLを指定できないので、空とする } else { $url = implode('/', [config('app.url'), 'app/receipt-issuing-oreder', $this->order->access_token]); } return View::make('sms.announce_receipt_issusing_order_form', [ 'url' => $url, ])->render(); } }