PHP code example of aniket / laravel-wallet-system

1. Go to this page and download the library: Download aniket/laravel-wallet-system library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

aniket / laravel-wallet-system example snippets


return [
    'users_table' => 'users',                    // Table name for users
    'wallet_balance_column' => 'wallet_balance',// Column for storing wallet balance
    'lock_duration' => 10,                       // Cache lock duration in seconds
    'default_balance' => 0.00,                   // Default balance for new users
];

use Aniket\LaravelWalletSystem\Traits\HasWallet;

class User extends Authenticatable {
    use HasWallet;
}

$user = User::find(1);
$user->credit(1000, 'Signup Bonus');

$user = User::find(1);
$user->debit(250, 'Purchase');

$user = User::find(1);
$user->refund(100, 'Failed order refund');
bash
php artisan migrate