Correctly json_encode validation errors.
This commit is contained in:
parent
05d2a6d370
commit
5bbded2c03
|
@ -141,7 +141,7 @@ class APIRepository
|
||||||
// Run validator, throw catchable and displayable exception if it fails.
|
// Run validator, throw catchable and displayable exception if it fails.
|
||||||
// Exception includes a JSON result of failed validation rules.
|
// Exception includes a JSON result of failed validation rules.
|
||||||
if ($validator->fails()) {
|
if ($validator->fails()) {
|
||||||
throw new DisplayValidationException($validator->errors());
|
throw new DisplayValidationException(json_encode($validator->errors()));
|
||||||
}
|
}
|
||||||
|
|
||||||
DB::beginTransaction();
|
DB::beginTransaction();
|
||||||
|
|
|
@ -60,7 +60,7 @@ class NodeRepository
|
||||||
// Run validator, throw catchable and displayable exception if it fails.
|
// Run validator, throw catchable and displayable exception if it fails.
|
||||||
// Exception includes a JSON result of failed validation rules.
|
// Exception includes a JSON result of failed validation rules.
|
||||||
if ($validator->fails()) {
|
if ($validator->fails()) {
|
||||||
throw new DisplayValidationException($validator->errors());
|
throw new DisplayValidationException(json_encode($validator->errors()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Verify the FQDN if using SSL
|
// Verify the FQDN if using SSL
|
||||||
|
@ -109,7 +109,7 @@ class NodeRepository
|
||||||
// Run validator, throw catchable and displayable exception if it fails.
|
// Run validator, throw catchable and displayable exception if it fails.
|
||||||
// Exception includes a JSON result of failed validation rules.
|
// Exception includes a JSON result of failed validation rules.
|
||||||
if ($validator->fails()) {
|
if ($validator->fails()) {
|
||||||
throw new DisplayValidationException($validator->errors());
|
throw new DisplayValidationException(json_encode($validator->errors()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Verify the FQDN
|
// Verify the FQDN
|
||||||
|
@ -193,7 +193,7 @@ class NodeRepository
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if ($validator->fails()) {
|
if ($validator->fails()) {
|
||||||
throw new DisplayValidationException($validator->errors());
|
throw new DisplayValidationException(json_encode($validator->errors()));
|
||||||
}
|
}
|
||||||
|
|
||||||
$explode = explode('/', $data['allocation_ip']);
|
$explode = explode('/', $data['allocation_ip']);
|
||||||
|
|
|
@ -58,7 +58,7 @@ class OptionRepository
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if ($validator->fails()) {
|
if ($validator->fails()) {
|
||||||
throw new DisplayValidationException($validator->errors());
|
throw new DisplayValidationException(json_encode($validator->errors()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($data['config_from'])) {
|
if (isset($data['config_from'])) {
|
||||||
|
@ -141,7 +141,7 @@ class OptionRepository
|
||||||
});
|
});
|
||||||
|
|
||||||
if ($validator->fails()) {
|
if ($validator->fails()) {
|
||||||
throw new DisplayValidationException($validator->errors());
|
throw new DisplayValidationException(json_encode($validator->errors()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($data['config_from'])) {
|
if (isset($data['config_from'])) {
|
||||||
|
|
|
@ -114,7 +114,7 @@ class ServerRepository
|
||||||
// Run validator, throw catchable and displayable exception if it fails.
|
// Run validator, throw catchable and displayable exception if it fails.
|
||||||
// Exception includes a JSON result of failed validation rules.
|
// Exception includes a JSON result of failed validation rules.
|
||||||
if ($validator->fails()) {
|
if ($validator->fails()) {
|
||||||
throw new DisplayValidationException($validator->errors());
|
throw new DisplayValidationException(json_encode($validator->errors()));
|
||||||
}
|
}
|
||||||
|
|
||||||
$user = Models\User::findOrFail($data['user_id']);
|
$user = Models\User::findOrFail($data['user_id']);
|
||||||
|
@ -360,7 +360,7 @@ class ServerRepository
|
||||||
// Run validator, throw catchable and displayable exception if it fails.
|
// Run validator, throw catchable and displayable exception if it fails.
|
||||||
// Exception includes a JSON result of failed validation rules.
|
// Exception includes a JSON result of failed validation rules.
|
||||||
if ($validator->fails()) {
|
if ($validator->fails()) {
|
||||||
throw new DisplayValidationException($validator->errors());
|
throw new DisplayValidationException(json_encode($validator->errors()));
|
||||||
}
|
}
|
||||||
|
|
||||||
DB::beginTransaction();
|
DB::beginTransaction();
|
||||||
|
@ -437,7 +437,7 @@ class ServerRepository
|
||||||
// Run validator, throw catchable and displayable exception if it fails.
|
// Run validator, throw catchable and displayable exception if it fails.
|
||||||
// Exception includes a JSON result of failed validation rules.
|
// Exception includes a JSON result of failed validation rules.
|
||||||
if ($validator->fails()) {
|
if ($validator->fails()) {
|
||||||
throw new DisplayValidationException($validator->errors());
|
throw new DisplayValidationException(json_encode($validator->errors()));
|
||||||
}
|
}
|
||||||
|
|
||||||
DB::beginTransaction();
|
DB::beginTransaction();
|
||||||
|
@ -492,7 +492,7 @@ class ServerRepository
|
||||||
// Run validator, throw catchable and displayable exception if it fails.
|
// Run validator, throw catchable and displayable exception if it fails.
|
||||||
// Exception includes a JSON result of failed validation rules.
|
// Exception includes a JSON result of failed validation rules.
|
||||||
if ($validator->fails()) {
|
if ($validator->fails()) {
|
||||||
throw new DisplayValidationException($validator->errors());
|
throw new DisplayValidationException(json_encode($validator->errors()));
|
||||||
}
|
}
|
||||||
|
|
||||||
DB::beginTransaction();
|
DB::beginTransaction();
|
||||||
|
|
|
@ -48,7 +48,7 @@ class ServiceRepository
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if ($validator->fails()) {
|
if ($validator->fails()) {
|
||||||
throw new DisplayValidationException($validator->errors());
|
throw new DisplayValidationException(json_encode($validator->errors()));
|
||||||
}
|
}
|
||||||
|
|
||||||
return DB::transaction(function () use ($data) {
|
return DB::transaction(function () use ($data) {
|
||||||
|
@ -94,7 +94,7 @@ class ServiceRepository
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if ($validator->fails()) {
|
if ($validator->fails()) {
|
||||||
throw new DisplayValidationException($validator->errors());
|
throw new DisplayValidationException(json_encode($validator->errors()));
|
||||||
}
|
}
|
||||||
|
|
||||||
return DB::transaction(function () use ($data, $service) {
|
return DB::transaction(function () use ($data, $service) {
|
||||||
|
|
|
@ -67,7 +67,7 @@ class UserRepository
|
||||||
// Run validator, throw catchable and displayable exception if it fails.
|
// Run validator, throw catchable and displayable exception if it fails.
|
||||||
// Exception includes a JSON result of failed validation rules.
|
// Exception includes a JSON result of failed validation rules.
|
||||||
if ($validator->fails()) {
|
if ($validator->fails()) {
|
||||||
throw new DisplayValidationException($validator->errors());
|
throw new DisplayValidationException(json_encode($validator->errors()));
|
||||||
}
|
}
|
||||||
|
|
||||||
DB::beginTransaction();
|
DB::beginTransaction();
|
||||||
|
@ -141,7 +141,7 @@ class UserRepository
|
||||||
// Run validator, throw catchable and displayable exception if it fails.
|
// Run validator, throw catchable and displayable exception if it fails.
|
||||||
// Exception includes a JSON result of failed validation rules.
|
// Exception includes a JSON result of failed validation rules.
|
||||||
if ($validator->fails()) {
|
if ($validator->fails()) {
|
||||||
throw new DisplayValidationException($validator->errors());
|
throw new DisplayValidationException(json_encode($validator->errors()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// The password and root_admin fields are not mass assignable.
|
// The password and root_admin fields are not mass assignable.
|
||||||
|
|
|
@ -63,7 +63,7 @@ class VariableRepository
|
||||||
});
|
});
|
||||||
|
|
||||||
if ($validator->fails()) {
|
if ($validator->fails()) {
|
||||||
throw new DisplayValidationException($validator->errors());
|
throw new DisplayValidationException(json_encode($validator->errors()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($data['env_variable'])) {
|
if (isset($data['env_variable'])) {
|
||||||
|
@ -137,7 +137,7 @@ class VariableRepository
|
||||||
});
|
});
|
||||||
|
|
||||||
if ($validator->fails()) {
|
if ($validator->fails()) {
|
||||||
throw new DisplayValidationException($validator->errors());
|
throw new DisplayValidationException(json_encode($validator->errors()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($data['env_variable'])) {
|
if (isset($data['env_variable'])) {
|
||||||
|
|
Loading…
Reference in New Issue