Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Laravel Wallet Laravel Package

zotel/laravel-wallet

View on GitHub
Deep Wiki
Context7

Withdraw

When there is enough money in the account, you can transfer/withdraw it or buy something in the system.

Since the currency is virtual, you can buy any services on your website. For example, priority in search results.

User Model

Make a Withdraw

Find user:

$user = User::first(); 

As the user uses HasWalletFloat, he will have balance property. Check the user's balance.

$user->balance; // 10000
$user->balanceInt; // 10000
$user->balanceFloatNum; // 100.00

The balance is not empty, so you can withdraw funds.

$user->withdrawFloat(10); 
$user->balance; // 9000
$user->balanceInt; // 9000
$user->balanceFloatNum; // 90.00

It's simple!

Force Withdraw

Forced withdrawal is necessary for those cases when the user has no funds. For example, a fine for spam.

$user->balanceFloatNum; // 90.00
$user->forceWithdrawFloat(101);
$user->balanceFloatNum; // -11.00

And what will happen if the money is not enough?

There can be two situations:

  • The user's balance is zero, then we get an error Zotel\Wallet\Exceptions\BalanceIsEmpty
  • If the balance is greater than zero, but it is not enough Zotel\Wallet\Exceptions\InsufficientFunds
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
jayeshmepani/jpl-moshier-ephemeris-php
elnasnato/laraliveui
labrodev/rest-sdk
sampaui/sampaui
babelqueue/php-sdk
facebook/capi-param-builder-php
babelqueue/symfony
hamzi/corewatch
minionfactory/raw-hydrator
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle