|
- <?php
-
- namespace App\Logic\ReceiptIssuingOrder;
-
- use App\Codes\ReceiptIssuingOrderStatus;
- use App\Exceptions\AppCommonException;
- use App\Logic\SMS\SMSManager;
- use App\Models\ReceiptIssuingOrder;
- use PDF;
-
- class UpdateManager extends ReceiptIssuingOrderManager
- {
-
- public function __construct(
- protected ReceiptIssuingOrder $order,
- protected SMSManager $smsManager
- ) {
- }
-
- 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;
- }
-
- protected function service()
- {
- $order = $this->order;
-
- $pdf = PDF::loadView('pdf', $order);
- // はがきサイズを指定
- $ret = $pdf->setOption('page-height', 148)
- ->setOption('page-width', 100)
- ->setOption('encoding', 'utf-8')
- ->inline();
-
- $order->status = ReceiptIssuingOrderStatus::DOWNLOAD_DONE;
-
- return $ret;
- }
- }
|