PHP code example of krutyosila / wallet

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

    

krutyosila / wallet example snippets


'providers' => [
...
    \Krutyosila\Wallet\WalletServiceProvider
...
];

php artisan vendor:publish --tag=wallet-migrations

protected function create(array $data)
{
    $user = User::create([
        'name' => $data['name'],
        'email' => $data['email'],
        'password' => Hash::make($data['password']),
    ]);
    $user->wallet()->create();
    return $user;
}

$intermediary = 'Bank';
$amount = 10.50;
$meta = [
    'hello' => 'world',
];
$confirmed = false;
$user->deposit($intermediary, $amount, $meta, $confirmed);
//or
$user->withdraw($intermediary, $amount, $meta, $confirmed);