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.

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. namespace App\DTO;
  3. use Livewire\Wireable;
  4. class ReportDTO implements Wireable
  5. {
  6. public function __construct(
  7. /**
  8. * @var AccountCategoryDTO[]
  9. */
  10. public array $categories,
  11. public AccountBalanceDTO $overallTotal,
  12. public array $fields,
  13. ) {}
  14. public function toLivewire(): array
  15. {
  16. return [
  17. 'categories' => $this->categories,
  18. 'overallTotal' => $this->overallTotal->toLivewire(),
  19. 'fields' => $this->fields,
  20. ];
  21. }
  22. public static function fromLivewire($value): static
  23. {
  24. return new static(
  25. $value['categories'],
  26. AccountBalanceDTO::fromLivewire($value['overallTotal']),
  27. $value['fields'],
  28. );
  29. }
  30. }