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 HasWallet, he will have balance property. Check the user's balance.

$user->balance; // 100
$user->balanceInt; // 100

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

$user->withdraw(10); 
$user->balance; // 90
$user->balanceInt; // 90

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->balance; // 100
$user->balanceInt; // 100
$user->forceWithdraw(101);
$user->balance; // -1
$user->balanceInt; // -1

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.
calmfox/watch-sylius
damienfern/grpc-symfony-bundle
atoolo/index-bundle
atoolo/genai-bundle
coprotoai/laravel-ticket
davidjln/llm-carbon-bundle
cryonighter/valid-request-bundle
coolms/taxonomy-bundle
coolms/field-bundle
articulate-orm/symfony
aaix/laravel-tall-architect
ephoto/akeneo-connector
emmanuelballery/eb-plantumlbundle
emielburgman/symfony-visitor-beacon
emielburgman/symfony-visit-storage
emielburgman/symfony-security-headers
emielburgman/symfony-log-viewer
emarref/xdebug-bundle
emarref/pubnub-bundle
elriseio/finance-money-bundle