combine validation
This commit is contained in:
parent
d67f65bb71
commit
66e94dd7c0
1 changed files with 3 additions and 9 deletions
|
@ -130,7 +130,9 @@ class OptionRepository
|
|||
'config_from' => 'sometimes|required|numeric|exists:service_options,id',
|
||||
]);
|
||||
|
||||
$validator->sometimes('config_startup', 'required_without:config_from|json', function ($input) use ($option) {
|
||||
$validator->sometimes([
|
||||
'config_startup', 'config_logs', 'config_files',
|
||||
], 'required_without:config_from|json', function ($input) use ($option) {
|
||||
return ! (! $input->config_from && ! is_null($option->config_from));
|
||||
});
|
||||
|
||||
|
@ -138,14 +140,6 @@ class OptionRepository
|
|||
return ! (! $input->config_from && ! is_null($option->config_from));
|
||||
});
|
||||
|
||||
$validator->sometimes('config_logs', 'required_without:config_from|json', function ($input) use ($option) {
|
||||
return ! (! $input->config_from && ! is_null($option->config_from));
|
||||
});
|
||||
|
||||
$validator->sometimes('config_files', 'required_without:config_from|json', function ($input) use ($option) {
|
||||
return ! (! $input->config_from && ! is_null($option->config_from));
|
||||
});
|
||||
|
||||
if ($validator->fails()) {
|
||||
throw new DisplayValidationException($validator->errors());
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue