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

45 lines
928B

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