PHP code example of hesamrad / laravel-wallet

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

    

hesamrad / laravel-wallet example snippets


use Illuminate\Foundation\Auth\User as Authenticatable;
use HesamRad\LaravelWallet\Contracts\HasWallet;
use HesamRad\LaravelWallet\Concerns\InteractsWithWallet;

class User extends Authenticatable implements HasWallet
{
    use InteractsWithWallet;

    // The resf of the model...
}

$user->deposit(
    amount: 1.25, 
    description: 'This is a test.',
    meta: [
        'key' => 'value'
    ]
);

$user->withdraw(
    amount: 1.00, 
    description: 'This is another test.',
    meta: [
        'another-key' => 'another-value'
    ]
);

$user->balance();

$user->wallet?->logs;
bash
php artisan vendor:publish --provider="HesamRad\LaravelWallet\LaravelWalletServiceProvider"
bash
php artisan migrate