Skip to content

Commit

Permalink
Updating README
Browse files Browse the repository at this point in the history
  • Loading branch information
3m1n3nc3 committed Jan 8, 2024
1 parent 6c2fdbb commit 37c2a04
Showing 1 changed file with 37 additions and 5 deletions.
42 changes: 37 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ php artisan vendor:publish --tag="pay-pocket-wallets"

This command will automatically publish the `WalletEnums.php` file into your application's `app/Enums` directory.

## Updating

If updating from version `<= 1.0.3`, new migrations have been added to support the new [Transaction Info Feature](#transaction-info)

Follow the [Installation](#installation) Step 2 to update your migrations.

## Preparation

### Prepare User Model
Expand Down Expand Up @@ -100,17 +106,30 @@ If the balance in `wallet_1` is 10 and the balance in `wallet_2` is 20, and you

### Deposit

```php
deposit(type: 'wallet_1', amount: 123.45, notes: null)
```

Deposit funds into `wallet_1`

```php
$user = auth()->user();
$user->deposit('wallet_1', 123.45);
```

$user->deposit('wallet_1', 123.45); // Deposit funds into 'wallet_1'
Deposit funds into `wallet_2`

$user->deposit('wallet_2', 67.89); // Deposit funds into 'wallet_2'
```php
$user = auth()->user();
$user->deposit('wallet_2', 67.89);
```

// Or using provided facade
Or using provided facade

```php
use HPWebdeveloper\LaravelPayPocket\Facades\LaravelPayPocket;

$user = auth()->user();
LaravelPayPocket::deposit($user, 'wallet_1', 123.45);

```
Expand All @@ -129,16 +148,27 @@ $user->deposit('wallet_1', 67.89, 'You ordered pizza.');
### Pay

```php
// Pay the value using the total combined balance available across all wallets
pay(amount: 12.34, notes: null)
```

Pay the value using the total combined balance available across all allowed wallets

```php
$user = auth()->user();
$user->pay(12.34);
```

// Or using provided facade
Or using provided facade

```php
use HPWebdeveloper\LaravelPayPocket\Facades\LaravelPayPocket;

$user = auth()->user();
LaravelPayPocket::pay($user, 12.34);
```

By default the sytem will attempt to pay using all available wallets exept the `allowedWallets` param is provided.

### Balance

- **Wallets**
Expand Down Expand Up @@ -206,3 +236,5 @@ Please review [our security policy](../../security/policy) on how to report secu
## License

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

[i8]: https://github.com/HPWebdeveloper/laravel-pay-pocket/issues/8

0 comments on commit 37c2a04

Please sign in to comment.