Fixes for client validation
This commit is contained in:
parent
4a60371da0
commit
e5df6754fe
|
|
@ -43,6 +43,8 @@ class StoreBankTransactionRequest extends Request
|
|||
|
||||
$rules['bank_integration_id'] = 'bail|required|exists:bank_integrations,id,company_id,'.$user->company()->id.',is_deleted,0';
|
||||
$rules['amount'] = ['sometimes', 'bail', 'numeric', 'nullable', 'max:99999999999999'];
|
||||
$rules['base_type'] = ['required','in:debit,credit', 'bail'];
|
||||
|
||||
return $rules;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -75,10 +75,26 @@ class StoreClientRequest extends Request
|
|||
$rules['shipping_country_id'] = 'integer|nullable|exists:countries,id';
|
||||
$rules['number'] = ['sometimes', 'nullable', 'bail', Rule::unique('clients')->where('company_id', $user->company()->id)];
|
||||
$rules['country_id'] = 'integer|nullable|exists:countries,id';
|
||||
$rules['custom_value1'] = 'bail|nullable|sometimes|alpha_num';
|
||||
$rules['custom_value2'] = 'bail|nullable|sometimes|alpha_num';
|
||||
$rules['custom_value3'] = 'bail|nullable|sometimes|alpha_num';
|
||||
$rules['custom_value4'] = 'bail|nullable|sometimes|alpha_num';
|
||||
$rules['custom_value1'] = ['bail','nullable','sometimes',function ($attribute, $value, $fail) {
|
||||
if (is_array($value)) {
|
||||
$fail("The $attribute must not be an array.");
|
||||
}
|
||||
}];
|
||||
$rules['custom_value2'] = ['bail','nullable','sometimes',function ($attribute, $value, $fail) {
|
||||
if (is_array($value)) {
|
||||
$fail("The $attribute must not be an array.");
|
||||
}
|
||||
}];
|
||||
$rules['custom_value3'] = ['bail','nullable','sometimes',function ($attribute, $value, $fail) {
|
||||
if (is_array($value)) {
|
||||
$fail("The $attribute must not be an array.");
|
||||
}
|
||||
}];
|
||||
$rules['custom_value4'] = ['bail','nullable','sometimes',function ($attribute, $value, $fail) {
|
||||
if (is_array($value)) {
|
||||
$fail("The $attribute must not be an array.");
|
||||
}
|
||||
}];
|
||||
|
||||
return $rules;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -75,10 +75,28 @@ class UpdateClientRequest extends Request
|
|||
//'regex:/[@$!%*#?&.]/', // must contain a special character
|
||||
];
|
||||
|
||||
$rules['custom_value1'] = 'bail|nullable|sometimes|alpha_num';
|
||||
$rules['custom_value2'] = 'bail|nullable|sometimes|alpha_num';
|
||||
$rules['custom_value3'] = 'bail|nullable|sometimes|alpha_num';
|
||||
$rules['custom_value4'] = 'bail|nullable|sometimes|alpha_num';
|
||||
|
||||
$rules['custom_value1'] = ['bail','nullable','sometimes',function ($attribute, $value, $fail) {
|
||||
if (is_array($value)) {
|
||||
$fail("The $attribute must not be an array.");
|
||||
}
|
||||
}];
|
||||
$rules['custom_value2'] = ['bail','nullable','sometimes',function ($attribute, $value, $fail) {
|
||||
if (is_array($value)) {
|
||||
$fail("The $attribute must not be an array.");
|
||||
}
|
||||
}];
|
||||
$rules['custom_value3'] = ['bail','nullable','sometimes',function ($attribute, $value, $fail) {
|
||||
if (is_array($value)) {
|
||||
$fail("The $attribute must not be an array.");
|
||||
}
|
||||
}];
|
||||
$rules['custom_value4'] = ['bail','nullable','sometimes',function ($attribute, $value, $fail) {
|
||||
if (is_array($value)) {
|
||||
$fail("The $attribute must not be an array.");
|
||||
}
|
||||
}];
|
||||
|
||||
|
||||
return $rules;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue