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

51 lines
1.1KB

  1. <?php
  2. namespace App\Logic\ReceiptIssuingOrder\Custom\HelloTechno;
  3. use App\Jobs\Other\Custom\HelloTechno\CacheParkingName;
  4. use App\Logic\ReceiptIssuingOrder\CreateManager as BaseManager;
  5. use App\Models\ReceiptIssuingHTParkingCustomOrder;
  6. class CreateManager
  7. {
  8. public function __construct(
  9. protected BaseManager $manager,
  10. private ReceiptIssuingHTParkingCustomOrder $customOrder,
  11. ) {
  12. }
  13. public function init(): static
  14. {
  15. $this->manager->init();
  16. return $this;
  17. }
  18. public function fill(array $attr): static
  19. {
  20. $this->manager->fill($attr);
  21. $this->customOrder->fill($attr);
  22. return $this;
  23. }
  24. public function create(): array
  25. {
  26. $messages = $this->manager->create();
  27. if (count($messages) !== 0) {
  28. return $messages;
  29. }
  30. $this->customOrder->setReceiptIssuingOrder($this->manager->id());
  31. $this->customOrder->save();
  32. // 駐車場名キャッシュ
  33. CacheParkingName::dispatch($this->customOrder->customer_code, $this->customOrder->parking_management_code);
  34. return [];
  35. }
  36. }