選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

AccountBalanceDTO.php 973B

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. namespace App\DTO;
  3. use Livewire\Wireable;
  4. class AccountBalanceDTO implements Wireable
  5. {
  6. public function __construct(
  7. public ?string $startingBalance,
  8. public string $debitBalance,
  9. public string $creditBalance,
  10. public ?string $netMovement,
  11. public ?string $endingBalance,
  12. ) {
  13. }
  14. public function toLivewire(): array
  15. {
  16. return [
  17. 'startingBalance' => $this->startingBalance,
  18. 'debitBalance' => $this->debitBalance,
  19. 'creditBalance' => $this->creditBalance,
  20. 'netMovement' => $this->netMovement,
  21. 'endingBalance' => $this->endingBalance,
  22. ];
  23. }
  24. public static function fromLivewire($value): static
  25. {
  26. return new static(
  27. $value['startingBalance'],
  28. $value['debitBalance'],
  29. $value['creditBalance'],
  30. $value['netMovement'],
  31. $value['endingBalance'],
  32. );
  33. }
  34. }