Skip to content

Commit

Permalink
method casts()
Browse files Browse the repository at this point in the history
  • Loading branch information
rez1dent3 committed Feb 13, 2024
1 parent 93541a0 commit e1c58eb
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 20 deletions.
15 changes: 9 additions & 6 deletions src/Models/Transaction.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,16 @@ class Transaction extends Model
];

/**
* @var array<string, string>
* @return array<string, string>
*/
protected $casts = [
'wallet_id' => 'int',
'confirmed' => 'bool',
'meta' => 'json',
];
public function casts(): array
{
return [
'wallet_id' => 'int',
'confirmed' => 'bool',
'meta' => 'json',
];
}

public function getTable(): string
{
Expand Down
16 changes: 10 additions & 6 deletions src/Models/Transfer.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,17 @@ class Transfer extends Model
];

/**
* @var array<string, string>
* @return array<string, string>
*/
protected $casts = [
'deposit_id' => 'int',
'withdraw_id' => 'int',
'extra' => 'json',
];
public function casts(): array
{

return [
'deposit_id' => 'int',
'withdraw_id' => 'int',
'extra' => 'json',
];
}

public function getTable(): string
{
Expand Down
19 changes: 11 additions & 8 deletions src/Models/Wallet.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,6 @@ class Wallet extends Model implements Customer, WalletFloat, Confirmable, Exchan
'updated_at',
];

/**
* @var array<string, string>
*/
protected $casts = [
'decimal_places' => 'int',
'meta' => 'json',
];

/**
* @var array<string, int|string>
*/
Expand All @@ -89,6 +81,17 @@ class Wallet extends Model implements Customer, WalletFloat, Confirmable, Exchan
'decimal_places' => 2,
];

/**
* @return array<string, string>
*/
public function casts(): array
{
return [
'decimal_places' => 'int',
'meta' => 'json',
];
}

public function getTable(): string
{
if ((string) $this->table === '') {
Expand Down

0 comments on commit e1c58eb

Please sign in to comment.