Download the PHP package hesamrad/laravel-wallet without Composer
On this page you can find all versions of the php package hesamrad/laravel-wallet. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download hesamrad/laravel-wallet
More information about hesamrad/laravel-wallet
Files in hesamrad/laravel-wallet
Package laravel-wallet
Short Description A minimalistic wallet for any Laravel application allowing logging and concurrency.
License MIT
Homepage https://github.com/hesamzakerirad/laravel-wallet
Informations about the package laravel-wallet
Laravel Wallet
A minimalistic wallet for any Laravel application; it's easy to install and to work with. It also logs every transaction inside storage for future monitoring.
Installation
Install via Composer:
The package will automatically register its service provider.
Configuration
Publish the necessary files:
This will publish the config, migrations and language files used by the wallet.
Usage
There is not much to do after installing. You only have to add a few lines to your desired model to get started; I presume you have a User model that needs a wallet.
- Have the
Usermodel implement\HesamRad\LaravelWallet\Contracts\HasWalletinterface. - Use the
\HesamRad\LaravelWallet\Concerns\InteractsWithWallettrait inside theUsermodel.
This will register neccessary methods and functionalities to work with wallet.
And then run the migtations:
And you're done!
How to deposit money into the wallet?
To deposit money into the wallet, call the deposit method on the model:
This will deposit 1.25 into the user's wallet and logs the transaction inside wallet_logs table. (Note that the description and meta fields will be stored inside wallet_logs table.)
How to withdraw money from the wallet?
To withdraw money from the wallet, call the withdraw method on the model:
This will withdraw 1.00 from the user's wallet and logs the transaction inside wallet_logs table. (Note that the description and meta fields will be stored inside wallet_logs table.)
How to get current balance of the wallet?
To get current balance of the wallet, call the balance method on the model:
How to get wallet logs?
To get wallet logs, call logs relationship on the wallet:
Support
If you encounter any issues, have questions or some idea to improve the package, feel free to create an issue or reach out to me:
- Create a new issue
- Email me
License
This package is open-source software licensed under the MIT license.
Credits
- Hesam Rad
- All Contributors
All versions of laravel-wallet with dependencies
illuminate/support Version ^10.0|^11.0|^12.0|^13.0
illuminate/database Version ^10.0|^11.0|^12.0|^13.0
illuminate/config Version ^10.0|^11.0|^12.0|^13.0