From 99c8b4bbd571ac69de7cdf1d0fcd8ee44a932eee Mon Sep 17 00:00:00 2001 From: Kekeocha Justin Chetachukwu <39213342+justinkekeocha@users.noreply.github.com> Date: Fri, 6 Oct 2023 16:28:03 +0100 Subject: [PATCH 1/3] docs: changing wallet decimal_places documented how to override wallet decimal_places Signed-off-by: Kekeocha Justin Chetachukwu <39213342+justinkekeocha@users.noreply.github.com> --- docs/configuration.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/docs/configuration.md b/docs/configuration.md index 2b77a1252..33d019763 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -40,4 +40,18 @@ class MyWallet extends WalletBase { echo $user->wallet->helloWorld(); ``` This same method above, can be used to extend the base `Transfer` and `Transaction` models and registering the extended models in the configuration file. +### Changing wallet decimal places + +You can change the default wallet decimal places, from your extended wallet model by defining a `decimal_places` attribute on the model. This is useful when working with fractional numbers + +```php[App/Models/MyWallet.php] +use Bavix\Wallet\Models\Wallet as WalletBase; + +class MyWallet extends WalletBase { + + protected $attributes = [ + 'decimal_places' => 18, + ]; +} +``` From 99665b4f5e659134704c2eb6ed06e4a2e7707be0 Mon Sep 17 00:00:00 2001 From: Kekeocha Justin Chetachukwu <39213342+justinkekeocha@users.noreply.github.com> Date: Fri, 6 Oct 2023 19:55:42 +0100 Subject: [PATCH 2/3] Update configuration.md Signed-off-by: Kekeocha Justin Chetachukwu <39213342+justinkekeocha@users.noreply.github.com> --- docs/configuration.md | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/docs/configuration.md b/docs/configuration.md index 33d019763..d0805166e 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -42,16 +42,18 @@ class MyWallet extends WalletBase { This same method above, can be used to extend the base `Transfer` and `Transaction` models and registering the extended models in the configuration file. ### Changing wallet decimal places -You can change the default wallet decimal places, from your extended wallet model by defining a `decimal_places` attribute on the model. This is useful when working with fractional numbers +You can change the default wallet decimal places, in wallet config file. -```php[App/Models/MyWallet.php] -use Bavix\Wallet\Models\Wallet as WalletBase; - -class MyWallet extends WalletBase { - - protected $attributes = [ - 'decimal_places' => 18, - ]; -} +```php[config/wallet.php] + /** + * Base model 'wallet'. + */ + 'wallet' => [ + .... + 'creating' => [ + 'decimal_places' => 18, + ], + .... + ], ``` From f38e8e53f6f870b1b9fcf6238ccf7197fe411c44 Mon Sep 17 00:00:00 2001 From: Kekeocha Justin Chetachukwu <39213342+justinkekeocha@users.noreply.github.com> Date: Fri, 6 Oct 2023 19:56:35 +0100 Subject: [PATCH 3/3] Update configuration.md Signed-off-by: Kekeocha Justin Chetachukwu <39213342+justinkekeocha@users.noreply.github.com> --- docs/configuration.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/configuration.md b/docs/configuration.md index d0805166e..41d5f0220 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -42,7 +42,7 @@ class MyWallet extends WalletBase { This same method above, can be used to extend the base `Transfer` and `Transaction` models and registering the extended models in the configuration file. ### Changing wallet decimal places -You can change the default wallet decimal places, in wallet config file. +You can change the default wallet decimal places, in wallet config file. This can be useful when working with fractional numbers. ```php[config/wallet.php] /**