Code Monkey home page Code Monkey logo

laravel-interior-multi-wallet's Introduction

install:

composer require icekristal/laravel-interior-multi-wallet

migration:

php artisan vendor:publish --provider="Icekristal\LaravelInteriorMultiWallet\IceInteriorMultiWalletServiceProvider" --tag="migrations"

config:

php artisan vendor:publish --provider="Icekristal\LaravelInteriorMultiWallet\IceInteriorMultiWalletServiceProvider" --tag="config"

lang:

php artisan vendor:publish --provider="Icekristal\LaravelInteriorMultiWallet\IceInteriorMultiWalletServiceProvider" --tag="translations"

use:

use Icekristal\LaravelInteriorMultiWallet\InteractsWithMultiWallet;

class User extends Model
{
    use InteractsWithMultiWallet;
}

get balance user:

$balanceDefaultCurrency = $modelUser->balance();
$balanceOtherCurrency = $modelUser->balance('key_other_currency'); //default balanceType = main
$balanceOtherCurrencyAndTypeBalance = $modelUser->balance('key_currency', 'demo'); //default balanceType = main

set debit balance:

$modelUser->debitBalance($amount, config('im_wallet.debit.put')); //Debit default currency
$modelUser->debitBalance($amount, config('im_wallet.debit.put'), 'key_other_currency'); //Debit other currency
$modelUser->debitBalance($amount, config('im_wallet.debit.put'), 'key_currency', 'type_balance'); //Debit other type_balance, see config im_wallet

set credit balance:

$modelUser->creditBalance($amount, config('im_wallet.credit.withdrawal')); //Credit default currency
$modelUser->creditBalance($amount, config('im_wallet.credit.withdrawal'), 'key_other_currency'); //Credit other currency
$modelUser->creditBalance($amount, config('im_wallet.credit.withdrawal'), 'key_currency', 'type_balance'); //Credit other type_balance, see config im_wallet

see transaction user

$modelUser->balanceTransaction()->get(); //All transaction
$modelUser->balanceTransaction($codeCurrency, $balanceType)->get(); //All transaction only codeCurrency and balanceType

block/unblock transaction user

$modelUser->blockTransaction($typeCredit, $codeCurrency, $balanceType); //Block transaction all params (permanent)
$modelUser->blockTransaction($typeCredit, $codeCurrency); //Block transaction only typeCredit and codeCurrency
$modelUser->blockTransaction(null, $codeCurrency, $balanceType); //Block transaction only codeCurrency and balanceType

$modelUser->unblockTransaction($typeCredit, $codeCurrency, $balanceType); //Unblock transaction all params
$modelUser->unblockTransaction($typeCredit, null, $balanceType); //Unblock only typeCredit and balanceType
$modelUser->unblockTransaction($typeCredit, $codeCurrency); //Unblock only typeCredit and codeCurrency

laravel-interior-multi-wallet's People

Contributors

icekristal avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.