mirror of
https://github.com/HDInnovations/UNIT3D-Community-Edition.git
synced 2026-04-27 05:50:51 -05:00
add: restrict bon upload purchases if buffer is too high
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -264,4 +264,21 @@ return [
|
||||
*/
|
||||
'every' => 5,
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| BON
|
||||
|--------------------------------------------------------------------------
|
||||
| Configures user bon transactions.
|
||||
*/
|
||||
'bon' => [
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| The maximum allowed account buffer when buying upload.
|
||||
|--------------------------------------------------------------------------
|
||||
| null = Disabled
|
||||
| Example : 10 * 1024 * 1024 * 1024 * 1024
|
||||
*/
|
||||
'max-buffer-to-buy-upload' => null,
|
||||
],
|
||||
];
|
||||
|
||||
@@ -44,6 +44,10 @@
|
||||
<button disabled class="form__button form__button--filled">
|
||||
{{ __('bon.activated') }}!
|
||||
</button>
|
||||
@elseif ($item->upload && config('other.bon.max-buffer-to-buy-upload') !== null && $user->uploaded - $user->downloaded > config('other.bon.max-buffer-to-buy-upload'))
|
||||
<button disabled class="form__button form__button--filled">
|
||||
Too much buffer!
|
||||
</button>
|
||||
@else
|
||||
<form
|
||||
method="POST"
|
||||
|
||||
Reference in New Issue
Block a user