PHP code example of irfa / dompet
1. Go to this page and download the library: Download irfa/dompet 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/ */
irfa / dompet example snippets
composer
'providers' => [
....
Irfa\Dompet\DompetServiceProvider::class,
];
'aliases' => [
....
'Dompet' => Irfa\Dompet\Saku\Dompet::class,
],
use Dompet;
...
Dompet::make($user->id, 123456);
//return boolean
...
Dompet::credential($userID,$pin)->update($new_pin);
//return boolean
...
Dompet::credential($userID,$pin)->balance(20000)->add("Some Transaction",$transaction_id);
//return boolean
...
Dompet::credential($userID,$pin)->balance(20000)->reduce("Some Transaction",$transaction_id);
//return boolean
...
Dompet::credential($user->id)->sumBalance();
//result 5000
//Formated number
Dompet::credential($user->id)->sumBalance(true);
// result 5,000
...
foreach(Dompet::credential($userID)->history() as $d)
{
echo $d->annotation." | ".$d->balance."<br>";
}
if(Dompet::credential()->balance(2000)->add("Some Transaction",$transaction_id))
{
echo "Succeded, ".Dompet::message();
} else
{
echo "Failed, ".Dompet::message();
}
php artisan migrate