PHP code example of hpwebdeveloper / laravel-pay-pocket
1. Go to this page and download the library: Download hpwebdeveloper/laravel-pay-pocket 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/ */
hpwebdeveloper / laravel-pay-pocket example snippets
use HPWebdeveloper\LaravelPayPocket\Interfaces\WalletOperations;
use HPWebdeveloper\LaravelPayPocket\Traits\ManagesWallet;
class User extends Authenticatable implements WalletOperations
{
use ManagesWallet;
}
namespace App\Enums;
enum WalletEnums: string
{
case WALLET1 = 'wallet_1';
case WALLET2 = 'wallet_2';
}
use HPWebdeveloper\LaravelPayPocket\Facades\LaravelPayPocket;
$user = auth()->user();
LaravelPayPocket::pay($user, 12.34);
$user->walletBalance // Total combined balance available across all wallets
// Or using provided facade
LaravelPayPocket::checkBalance($user);
$user->getWalletBalanceByType('wallet_1') // Balance available in wallet_1
$user->getWalletBalanceByType('wallet_2') // Balance available in wallet_2
// Or using provided facade
LaravelPayPocket::walletBalanceByType($user, 'wallet_1');