laraveleg / laravel-user-wallet
Create a cash wallet for the user that can deposit and withdraw
Installs: 10
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/laraveleg/laravel-user-wallet
Requires
- php: ^7.0
- laravel/framework: ^7.0 || ^8.0
README
Create a cash wallet for the user that can deposit and withdraw.
Requirements
- php ^7.0
- laravel/framework ^7.0 OR ^8.0
Install via composer
Add orm to composer.json configuration file.
$ composer require laraveleg/laravel-user-wallet
Migrate
$ php artisan migrate
add the trait in your model User in app/Models/User.php
file
use LaravelEG\UserWallet\Traits\UserWalletTrait; class User extends Authenticatable { use UserWalletTrait; ...
Functions
depositBalance
To deposit into a user's wallet.
Auth::user()->depositBalance(100, '<details>');
withdrawalBalance
For withdrawal from the user's wallet.
Auth::user()->withdrawalBalance(50, '<details>');
Attributes
balance
Fetch user balance.
Auth::user()->balance;
Listeners
Publish vendor
- Run
php artisan vendor:publish
- Selection
LaravelEG\UserWallet\UserWalletServiceProvider
Config file
Go to config/laraveleg/userwallet.php
- You can set listeners classes if when
depositing
andwithdrawal
THX.