Skip to content

Commit

Permalink
wallet change integer to float
Browse files Browse the repository at this point in the history
  • Loading branch information
megoxv committed Sep 25, 2024
1 parent 870ba4b commit 78337d2
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ public function form(Form $form): Form
$wallet = $user->wallet;

// Perform withdrawal
if ($wallet->balance >= $record->amount) {
$wallet->withdraw($record->amount);
if ($wallet->balanceFloatNum >= $record->amount) {
$wallet->withdrawFloat($record->amount);

// Update status
$record->status = 'completed';
Expand Down
4 changes: 2 additions & 2 deletions src/Filament/Resources/WithdrawalRequestResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ public static function form(Form $form): Form
$wallet = $user->wallet;

// Perform withdrawal
if ($wallet->balance >= $record->amount) {
$wallet->withdraw($record->amount);
if ($wallet->balanceFloatNum >= $record->amount) {
$wallet->withdrawFloat($record->amount);

// Update status
$record->status = 'completed';
Expand Down
2 changes: 1 addition & 1 deletion src/Services/FilamentWithdrawalFormBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ public function send(array $data): void
$user = auth('accounts')->user();
$wallet = $user->wallet;

if ($amount > $wallet->balance) {
if ($amount > $wallet->balanceFloatNum) {
Notification::make()
->title(trans('filament-withdrawals::messages.withdrawal_requests.notification.balance_is_not_enough.title'))
->body(trans('filament-withdrawals::messages.withdrawal_requests.notification.balance_is_not_enough.body'))
Expand Down

0 comments on commit 78337d2

Please sign in to comment.