add: restrict bon upload purchases if buffer is too high

This commit is contained in:
Roardom
2024-11-14 09:06:59 +00:00
parent 8eb1e64cc1
commit d9863fc346
3 changed files with 25 additions and 0 deletions
@@ -71,6 +71,10 @@ class TransactionController extends Controller
switch (true) {
case $bonExchange->upload:
if (config('other.bon.max-buffer-to-buy-upload') !== null && $user->uploaded - $user->downloaded > config('other.bon.max-buffer-to-buy-upload')) {
return back()->withErrors('You already have enough buffer.');
}
$user->increment('uploaded', $bonExchange->value);
break;