|
@@ -30,7 +30,7 @@ discard block |
|
|
block discarded – undo |
|
30
|
30
|
'client_idnumber' => 'required', |
|
31
|
31
|
'client_address' => 'required', |
|
32
|
32
|
'client_email' => 'required', |
|
33
|
|
- 'payments' => function ($attribute, $value, $fail) { |
|
|
33
|
+ 'payments' => function($attribute, $value, $fail) { |
|
34
|
34
|
$fieldGroups = json_decode($value); |
|
35
|
35
|
|
|
36
|
36
|
// allow repeatable field to be empty |
|
@@ -42,14 +42,14 @@ discard block |
|
|
block discarded – undo |
|
42
|
42
|
// run through each field group inside the repeatable field |
|
43
|
43
|
// and run a custom validation for it |
|
44
|
44
|
foreach ($fieldGroups as $key => $group) { |
|
45
|
|
- $fieldGroupValidator = Validator::make((array)$group, ['payment_method' => 'required|string', 'date' => 'required|date', 'value' => 'numeric|required', 'comment' => 'string|nullable', 'responsable_id' => 'nullable',]); |
|
|
45
|
+ $fieldGroupValidator = Validator::make((array) $group, ['payment_method' => 'required|string', 'date' => 'required|date', 'value' => 'numeric|required', 'comment' => 'string|nullable', 'responsable_id' => 'nullable', ]); |
|
46
|
46
|
|
|
47
|
47
|
if ($fieldGroupValidator->fails()) { |
|
48
|
48
|
return $fail($fieldGroupValidator->errors()->first()); |
|
49
|
49
|
} |
|
50
|
50
|
} |
|
51
|
51
|
}, |
|
52
|
|
- 'invoiceDetails' => function ($attribute, $value, $fail) { |
|
|
52
|
+ 'invoiceDetails' => function($attribute, $value, $fail) { |
|
53
|
53
|
$fieldGroups = json_decode($value); |
|
54
|
54
|
|
|
55
|
55
|
// allow repeatable field to be empty |
|
@@ -61,7 +61,7 @@ discard block |
|
|
block discarded – undo |
|
61
|
61
|
// run through each field group inside the repeatable field |
|
62
|
62
|
// and run a custom validation for it |
|
63
|
63
|
foreach ($fieldGroups as $key => $group) { |
|
64
|
|
- $fieldGroupValidator = Validator::make((array)$group, ['product_name' => 'required|string', 'price' => 'numeric|required', 'quantity' => 'numeric|required']); |
|
|
64
|
+ $fieldGroupValidator = Validator::make((array) $group, ['product_name' => 'required|string', 'price' => 'numeric|required', 'quantity' => 'numeric|required']); |
|
65
|
65
|
|
|
66
|
66
|
if ($fieldGroupValidator->fails()) { |
|
67
|
67
|
return $fail($fieldGroupValidator->errors()->first()); |