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

55 line
1.2KB

  1. <?php
  2. namespace App\Logic\ReceiptIssuingOrder;
  3. use App\Codes\ReceiptIssuingOrderStatus;
  4. use App\Exceptions\AppCommonException;
  5. use App\Logic\SMS\SMSManager;
  6. use App\Models\ReceiptIssuingOrder;
  7. use PDF;
  8. class UpdateManager extends ReceiptIssuingOrderManager
  9. {
  10. public function __construct(
  11. protected ReceiptIssuingOrder $order,
  12. protected SMSManager $smsManager
  13. ) {
  14. }
  15. public function initByToken(string $token)
  16. {
  17. $ret = $this->checkToken($token);
  18. if (!$ret) {
  19. throw new AppCommonException("トークン不正");
  20. }
  21. $this->initialized = true;
  22. return $this;
  23. }
  24. public function initById(string $id)
  25. {
  26. $this->fetch($id);
  27. $this->initialized = true;
  28. return $this;
  29. }
  30. protected function service()
  31. {
  32. $order = $this->order;
  33. $pdf = PDF::loadView('pdf', $order);
  34. // はがきサイズを指定
  35. $ret = $pdf->setOption('page-height', 148)
  36. ->setOption('page-width', 100)
  37. ->setOption('encoding', 'utf-8')
  38. ->inline();
  39. $order->status = ReceiptIssuingOrderStatus::DOWNLOAD_DONE;
  40. return $ret;
  41. }
  42. }