Andrew Wallo před 1 rokem
rodič
revize
bf62ce11ef

+ 1
- 25
app/DTO/AccountBalanceDTO.php Zobrazit soubor

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

+ 1
- 19
app/DTO/AccountCategoryDTO.php Zobrazit soubor

@@ -2,9 +2,7 @@
2 2
 
3 3
 namespace App\DTO;
4 4
 
5
-use Livewire\Wireable;
6
-
7
-class AccountCategoryDTO implements Wireable
5
+class AccountCategoryDTO
8 6
 {
9 7
     /**
10 8
      * @param  AccountDTO[]  $accounts
@@ -13,20 +11,4 @@ class AccountCategoryDTO implements Wireable
13 11
         public array $accounts,
14 12
         public AccountBalanceDTO $summary,
15 13
     ) {}
16
-
17
-    public function toLivewire(): array
18
-    {
19
-        return [
20
-            'accounts' => $this->accounts,
21
-            'summary' => $this->summary->toLivewire(),
22
-        ];
23
-    }
24
-
25
-    public static function fromLivewire($value): static
26
-    {
27
-        return new static(
28
-            $value['accounts'],
29
-            AccountBalanceDTO::fromLivewire($value['summary']),
30
-        );
31
-    }
32 14
 }

+ 1
- 23
app/DTO/AccountDTO.php Zobrazit soubor

@@ -2,9 +2,7 @@
2 2
 
3 3
 namespace App\DTO;
4 4
 
5
-use Livewire\Wireable;
6
-
7
-class AccountDTO implements Wireable
5
+class AccountDTO
8 6
 {
9 7
     public function __construct(
10 8
         public string $accountName,
@@ -12,24 +10,4 @@ class AccountDTO implements Wireable
12 10
         public ?int $accountId,
13 11
         public AccountBalanceDTO $balance,
14 12
     ) {}
15
-
16
-    public function toLivewire(): array
17
-    {
18
-        return [
19
-            'accountName' => $this->accountName,
20
-            'accountCode' => $this->accountCode,
21
-            'accountId' => $this->accountId,
22
-            'balance' => $this->balance->toLivewire(),
23
-        ];
24
-    }
25
-
26
-    public static function fromLivewire($value): static
27
-    {
28
-        return new static(
29
-            $value['accountName'],
30
-            $value['accountCode'],
31
-            $value['accountId'],
32
-            AccountBalanceDTO::fromLivewire($value['balance']),
33
-        );
34
-    }
35 13
 }

+ 1
- 21
app/DTO/ReportDTO.php Zobrazit soubor

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

+ 1
- 16
app/Transformers/BaseReportTransformer.php Zobrazit soubor

@@ -5,9 +5,8 @@ namespace App\Transformers;
5 5
 use App\Contracts\ExportableReport;
6 6
 use App\DTO\ReportDTO;
7 7
 use Filament\Support\Enums\Alignment;
8
-use Livewire\Wireable;
9 8
 
10
-abstract class BaseReportTransformer implements ExportableReport, Wireable
9
+abstract class BaseReportTransformer implements ExportableReport
11 10
 {
12 11
     protected ReportDTO $report;
13 12
 
@@ -40,18 +39,4 @@ abstract class BaseReportTransformer implements ExportableReport, Wireable
40 39
 
41 40
         return 'text-left';
42 41
     }
43
-
44
-    public function toLivewire(): array
45
-    {
46
-        return [
47
-            'report' => $this->report->toLivewire(),
48
-        ];
49
-    }
50
-
51
-    public static function fromLivewire($value): static
52
-    {
53
-        return new static(
54
-            ReportDTO::fromLivewire($value['report']),
55
-        );
56
-    }
57 42
 }

Načítá se…
Zrušit
Uložit