Skip to content

Commit e1c58eb

Browse files
committed
method casts()
1 parent 93541a0 commit e1c58eb

File tree

3 files changed

+30
-20
lines changed

3 files changed

+30
-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: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,17 @@ 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+
74+
return [
75+
'deposit_id' => 'int',
76+
'withdraw_id' => 'int',
77+
'extra' => 'json',
78+
];
79+
}
7680

7781
public function getTable(): string
7882
{

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)