|
- <?php
-
- namespace App\Logic\ReceiptIssuingOrder;
-
- use App\Exceptions\AppCommonException;
- use App\Logic\SMS\SMSManager;
- use App\Models\ReceiptIssuingOrder;
-
- class UpdateManager extends ReceiptIssuingOrderManager
- {
-
- public function __construct(
- protected ReceiptIssuingOrder $order,
- protected SMSManager $smsManager
- ) {
- parent::__construct($order);
- }
-
- public function initByToken(string $token)
- {
- $ret = $this->checkToken($token);
- if (!$ret) {
- throw new AppCommonException("トークン不正");
- }
-
- $this->initialized = true;
- return $this;
- }
-
- public function initById(string $id)
- {
- $this->fetch($id);
-
- $this->initialized = true;
- return $this;
- }
-
- public function fill(array $attr)
- {
- $this->order->fill($attr);
- return $this;
- }
-
- protected function service()
- {
- $order = $this->order;
-
- // パラメータチェック
- $messages = $this->paramCheck();
- if (count($messages) !== 0) {
- return $messages;
- }
-
- // モデル更新
- $order->save();
-
- return [];
- }
-
- private function paramCheck(): array
- {
- $ret = [];
- $order = $this->order;
-
- return $ret;
- }
- }
|