validation for enough money on a balance
This commit is contained in:
parent
80f394571d
commit
c202e9f64c
|
|
@ -147,6 +147,7 @@ class OfferForm extends ComponentBase
|
|||
$user = \Auth::user();
|
||||
if($user->balance - Settings::getValue('fee') < 0) {
|
||||
// ... message about not enough money
|
||||
throw new ValidationException(['money' => 'Пополните баланс']);
|
||||
} else {
|
||||
$user->balance = $user->balance - Settings::getValue('fee');
|
||||
$user->save();
|
||||
|
|
|
|||
|
|
@ -2,9 +2,17 @@
|
|||
Добавить объявление (Step 3)
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<form action="#" class="post_form" enctype="multipart/form-data"
|
||||
data-request="onPublish"
|
||||
data-request-validate
|
||||
>
|
||||
<!-- сообщение пополните баланс -->
|
||||
<div class="alert alert-danger" data-validate-error>
|
||||
<p data-message style="color: red;"></p> <br>
|
||||
</div>
|
||||
|
||||
<input type="hidden" name="product_id" value="{{product.id}}">
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue