-
-
Notifications
You must be signed in to change notification settings - Fork 233
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move package configuration to a separate section Signed-off-by: Kekeocha Justin Chetachukwu <[email protected]>
- Loading branch information
1 parent
80d31e8
commit d328a37
Showing
1 changed file
with
43 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# Configuration | ||
Though this package is crafted to suit most of your needs by default, you can edit the configuration file to suit certain demands. | ||
|
||
## Configure default wallet | ||
Customize `name`,`slug` and `meta` of default wallet. | ||
|
||
```php[config/wallet.php] | ||
'default' => [ | ||
'name' => 'Ethereum', | ||
'slug' => 'ETH', | ||
'meta' => [], | ||
], | ||
``` | ||
## Extend base Wallet model | ||
You can extend base Wallet model by creating a new class that extends `Bavix\Wallet\Models\Wallet` and registering the new class in `config/wallet.php`. | ||
Example `MyWallet.php` | ||
|
||
```php[App/Models/MyWallet.php] | ||
use Bavix\Wallet\Models\Wallet as WalletBase; | ||
class MyWallet extends WalletBase { | ||
public function helloWorld(): string { return "hello world"; } | ||
} | ||
``` | ||
### Register base Wallet model | ||
|
||
```php[config/wallet.php] | ||
'wallet' => [ | ||
'table' => 'wallets', | ||
'model' => MyWallet::class, | ||
'creating' => [], | ||
'default' => [ | ||
'name' => 'Default Wallet', | ||
'slug' => 'default', | ||
'meta' => [], | ||
], | ||
], | ||
``` | ||
```php | ||
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. | ||
|