stephenjude/laravel-wallet
소개
A simple wallet implementation for Laravel.
웹 및 앱 개발측정된 스타 증가
- in 24h
- 0
- in 7 days
- 0
- in 15 days
- 0
- in 1 month
- 기록 수집 중
서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.
README.md
OriginalLaravel Wallet
A simple wallet implementation for Laravel.
Learn More
- A Simple Wallet Implementation for Laravel - Laravel News
- Interfaces and Traits: How to Use Them in Laravel Packages - Laravel Daily
- Laravel Virtual Wallet with Coupons: 3 Packages Demo - Laravel Daily
Installation
You can install the package via composer:
composer require stephenjude/laravel-wallet
You can publish and run the migrations with:
php artisan vendor:publish --tag="wallet-migrations"
php artisan migrate
Usage
Prepare User Model
use Stephenjude\Wallet\Interfaces\Wallet;
use Stephenjude\Wallet\Traits\HasWallet;
class User extends Authenticatable implements Wallet
{
use HasWallet;
}
Deposit
$user = User::first();
$user->deposit(200.22); // returns the wallet balance: 200.22
$user->deposit(200); // returns the wallet balance: 400.22
Withdraw
$user->withdraw(200); // returns the wallet balance: 200.22
$user->withdraw(0.22); // returns the wallet balance: 200
Balance
$user->balance
$user->wallet_balance
Exceptions
InvalidAmountException
The InvalidAmountException is thrown whenever the deposit or withdrawal amount is a negative numeric value or zero.
InsufficientFundException
The InsufficientFundException is thrown whenever the withdrawal amount is less than the user's wallet balance.
Alternative Package
If you are looking for somthing much bigger and elaborate checkout Bavix Laravel Wallet.
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.
관련 프로젝트 살펴보기
불러오는 중…