Skip to content

Atunje/wallet

Repository files navigation

Wallet

A simple laravel package for wallet implementation.

This package can basically be plugged into a laravel project and it will handle wallet transactions. It allows for a user to have multiple wallets that can be given different names.

How to install

Install via composer

$ composer install nobelatunje/wallet

Copy the database migrations to your migrations folder and run

$ php artisan migrate

To create a wallet

$wallet = Wallet::create($user_id, "Car Savings Wallet");

To get user's wallets

$wallet = $this->hasMany(Wallet::class, 'user_id');

To credit a wallet

$wallet->credit(2000, "Payment for order #849494");

To debit a wallet

$wallet->debit(1000, "Purchase of airtime");

To reverse a transaction

$wallet = Wallet::find(2); 
$transaction = Transaction::find(3);

$wallet->reverseTransaction($transaction);

To view wallet transactions

Wallet::find(2)->transactions();

To retrieve wallets

Wallet::all();

To delete a wallet

Wallet::find(2)->delete();

About

A wallet package for laravel applications

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages