From e1c58eb81855ba7432cc82d7e0fe7721cfa57bf1 Mon Sep 17 00:00:00 2001 From: Maxim Babichev Date: Tue, 13 Feb 2024 18:42:53 +0300 Subject: [PATCH] method casts() --- src/Models/Transaction.php | 15 +++++++++------ src/Models/Transfer.php | 16 ++++++++++------ src/Models/Wallet.php | 19 +++++++++++-------- 3 files changed, 30 insertions(+), 20 deletions(-) diff --git a/src/Models/Transaction.php b/src/Models/Transaction.php index e2bcc4f7d..fc419c752 100644 --- a/src/Models/Transaction.php +++ b/src/Models/Transaction.php @@ -62,13 +62,16 @@ class Transaction extends Model ]; /** - * @var array + * @return array */ - 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 { diff --git a/src/Models/Transfer.php b/src/Models/Transfer.php index 656232ad7..4ea5545a7 100644 --- a/src/Models/Transfer.php +++ b/src/Models/Transfer.php @@ -66,13 +66,17 @@ class Transfer extends Model ]; /** - * @var array + * @return array */ - 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 { diff --git a/src/Models/Wallet.php b/src/Models/Wallet.php index d3dfa9157..b924b916f 100644 --- a/src/Models/Wallet.php +++ b/src/Models/Wallet.php @@ -73,14 +73,6 @@ class Wallet extends Model implements Customer, WalletFloat, Confirmable, Exchan 'updated_at', ]; - /** - * @var array - */ - protected $casts = [ - 'decimal_places' => 'int', - 'meta' => 'json', - ]; - /** * @var array */ @@ -89,6 +81,17 @@ class Wallet extends Model implements Customer, WalletFloat, Confirmable, Exchan 'decimal_places' => 2, ]; + /** + * @return array + */ + public function casts(): array + { + return [ + 'decimal_places' => 'int', + 'meta' => 'json', + ]; + } + public function getTable(): string { if ((string) $this->table === '') {