Skip to content

Commit

Permalink
default lockForUpdate added to wallet relation
Browse files Browse the repository at this point in the history
  • Loading branch information
Aniket-IN committed Jun 18, 2022
1 parent f1ef072 commit a7b2720
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Traits/HasWallet.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ trait HasWallet
public function wallet()
{
return $this->morphOne(Wallet::class, 'walletable')->withDefault(function ($wallet, $user) {
return $user->wallet()->firstOrCreate([
return $user->wallet()->lockForUpdate()->firstOrCreate([
'balance' => 0,
'withdrawable_balance' => 0,
]);
});
})->lockForUpdate();
}
}

0 comments on commit a7b2720

Please sign in to comment.