Skip to content

Commit

Permalink
Merge pull request #771 from justinkekeocha/patch-7
Browse files Browse the repository at this point in the history
docs: Create configuration.md
  • Loading branch information
rez1dent3 authored Sep 14, 2023
2 parents 80d31e8 + d328a37 commit 4289ec4
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions docs/configuration.md
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.

0 comments on commit 4289ec4

Please sign in to comment.