PHP code example of 3neti / cash

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

    

3neti / cash example snippets


loadMigrationsFrom()

use LBHurtado\Cash\Models\Cash;

$cash = Cash::create([
    'amount' => 1500.00,
    'currency' => 'PHP',
    'meta' => ['note' => 'Transport support'],
]);

use Brick\Money\Money;

$cash = Cash::create([
    'amount' => Money::of(1500, 'PHP'),
    'currency' => 'PHP',
]);

$cash->amount; // Brick\Money\Money instance
$cash->amount->getAmount()->toFloat(); // 1500.00
$cash->amount->getMinorAmount()->toInt(); // 150000

$cash->meta->note;
$cash->meta['note'];

$cash->expired = true;
$cash->save();

$cash->expired; // true

use LBHurtado\Cash\Enums\CashStatus;

$cash->setStatus(CashStatus::DISBURSED);

$cash->hasStatus(CashStatus::DISBURSED);
$cash->getCurrentStatus();

$cash->secret = '1234';
$cash->save();

$cash->verifySecret('1234'); // true

$cash->canRedeem('1234');

$cash->attachTag('transport');
$cash->tags;

$cash->depositFloat(1000);
$cash->withdrawFloat(500);

use LBHurtado\Cash\Data\CashData;

CashData::fromModel($cash);
bash
php artisan vendor:publish --tag=config
bash
php artisan migrate