税率大于0小于100
This commit is contained in:
parent
d670a46c32
commit
a01c57c025
|
|
@ -32,14 +32,20 @@ class TaxRateRequest extends FormRequest
|
||||||
*/
|
*/
|
||||||
public function rules(): array
|
public function rules(): array
|
||||||
{
|
{
|
||||||
return [
|
$rule = [
|
||||||
'name' => 'required|string|max:10',
|
'name' => 'required|string|max:10',
|
||||||
'rate' => 'required|numeric',
|
'rate' => 'required|numeric',
|
||||||
'type' => 'required|in:percent,flat',
|
'type' => 'required|in:percent,flat',
|
||||||
'region_id' => 'required|int',
|
'region_id' => 'required|int',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
if ($this->type == 'percent') {
|
||||||
|
$rule['rate'] = 'required|numeric|gt:0|lt:100';
|
||||||
|
}
|
||||||
|
return $rule;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function attributes()
|
public function attributes()
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue