PHP code example of stephenjude / laravel-wallet

1. Go to this page and download the library: Download stephenjude/laravel-wallet 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/ */

    

stephenjude / laravel-wallet example snippets



use Stephenjude\Wallet\Interfaces\Wallet;
use Stephenjude\Wallet\Traits\HasWallet;

class User extends Authenticatable implements Wallet
{
    use HasWallet;
}

$user = User::first();

$user->deposit(200.22); // returns the wallet balance: 200.22

$user->deposit(200); // returns the wallet balance: 400.22

$user->withdraw(200); // returns the wallet balance: 200.22

$user->withdraw(0.22); // returns the wallet balance: 200

$user->balance

$user->wallet_balance
bash
php artisan vendor:publish --tag="wallet-migrations"
php artisan migrate
bash)

[//]: # (php artisan vendor:publish --tag="wallet-config")

[//]: # (