Skip to content

Commit a7b2720

Browse files
committed
default lockForUpdate added to wallet relation
1 parent f1ef072 commit a7b2720

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Traits/HasWallet.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ trait HasWallet
99
public function wallet()
1010
{
1111
return $this->morphOne(Wallet::class, 'walletable')->withDefault(function ($wallet, $user) {
12-
return $user->wallet()->firstOrCreate([
12+
return $user->wallet()->lockForUpdate()->firstOrCreate([
1313
'balance' => 0,
1414
'withdrawable_balance' => 0,
1515
]);
16-
});
16+
})->lockForUpdate();
1717
}
1818
}

0 commit comments

Comments
 (0)