Skip to content

Commit 44ad253

Browse files
authored
Merge pull request #889 from bavix/casts-method
[11.x] method casts()
2 parents 93541a0 + 63ec9c4 commit 44ad253

File tree

3 files changed

+29
-20
lines changed

3 files changed

+29
-20
lines changed

src/Models/Transaction.php

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,16 @@ class Transaction extends Model
6262
];
6363

6464
/**
65-
* @var array<string, string>
65+
* @return array<string, string>
6666
*/
67-
protected $casts = [
68-
'wallet_id' => 'int',
69-
'confirmed' => 'bool',
70-
'meta' => 'json',
71-
];
67+
public function casts(): array
68+
{
69+
return [
70+
'wallet_id' => 'int',
71+
'confirmed' => 'bool',
72+
'meta' => 'json',
73+
];
74+
}
7275

7376
public function getTable(): string
7477
{

src/Models/Transfer.php

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,16 @@ class Transfer extends Model
6666
];
6767

6868
/**
69-
* @var array<string, string>
69+
* @return array<string, string>
7070
*/
71-
protected $casts = [
72-
'deposit_id' => 'int',
73-
'withdraw_id' => 'int',
74-
'extra' => 'json',
75-
];
71+
public function casts(): array
72+
{
73+
return [
74+
'deposit_id' => 'int',
75+
'withdraw_id' => 'int',
76+
'extra' => 'json',
77+
];
78+
}
7679

7780
public function getTable(): string
7881
{

src/Models/Wallet.php

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -73,14 +73,6 @@ class Wallet extends Model implements Customer, WalletFloat, Confirmable, Exchan
7373
'updated_at',
7474
];
7575

76-
/**
77-
* @var array<string, string>
78-
*/
79-
protected $casts = [
80-
'decimal_places' => 'int',
81-
'meta' => 'json',
82-
];
83-
8476
/**
8577
* @var array<string, int|string>
8678
*/
@@ -89,6 +81,17 @@ class Wallet extends Model implements Customer, WalletFloat, Confirmable, Exchan
8981
'decimal_places' => 2,
9082
];
9183

84+
/**
85+
* @return array<string, string>
86+
*/
87+
public function casts(): array
88+
{
89+
return [
90+
'decimal_places' => 'int',
91+
'meta' => 'json',
92+
];
93+
}
94+
9295
public function getTable(): string
9396
{
9497
if ((string) $this->table === '') {

0 commit comments

Comments
 (0)