close #464 Fixed: 0 Money payment in invoice and bill;

Transfer,
Bill, Bill Payment, Bill Total,
Payment,
Invoice, Invoice Payment, Invoice Total,
Revenue.
This commit is contained in:
cuneytsenturk
2018-08-30 11:58:38 +03:00
parent fc0048cdfa
commit eb5023759c
11 changed files with 34 additions and 17 deletions

View File

@ -18,20 +18,36 @@ class ValidationServiceProvider extends ServiceProvider
$currency_code = null;
Validator::extend('currency', function ($attribute, $value, $parameters, $validator) use(&$currency_code) {
$status = false;
$status = false;
$currencies = Currency::enabled()->pluck('name', 'code')->toArray();
$currencies = Currency::enabled()->pluck('name', 'code')->toArray();
if (array_key_exists($value, $currencies)) {
$status = true;
}
if (array_key_exists($value, $currencies)) {
$status = true;
}
$currency_code = $value;
$currency_code = $value;
return $status;
},
return $status;
},
trans('validation.custom.invalid_currency', ['attribute' => $currency_code])
);
$amount = null;
Validator::extend('amount', function ($attribute, $value, $parameters, $validator) use (&$amount) {
$status = false;
if ($value > 0) {
$status = true;
}
$amount = $value;
return $status;
},
trans('validation.custom.invalid_amount', ['attribute' => $amount])
);
}
/**