server create account recheak
This commit is contained in:
@@ -32,17 +32,15 @@ class ValidationMiddleware
|
||||
}
|
||||
$format = 'validation.'.$path.'@'.strtolower($method);
|
||||
if (config($format)) {
|
||||
if ($path == 'admin/user/{id}'){
|
||||
$replace = preg_replace('/update_id/', $match_id, config($format));
|
||||
$validator = Validator::make($request->all(), $replace);
|
||||
}
|
||||
// elseif(isset($match[0])){
|
||||
// $replace = preg_replace('/update_#/', $match[0], config($format));
|
||||
// $validator = Validator::make($request->all(), $replace);
|
||||
// }
|
||||
else{
|
||||
$validator = Validator::make($request->all(), config($format));
|
||||
$rules = config($format);
|
||||
if (isset($match_id)) {
|
||||
$rules = array_map(function ($rule) use ($match_id) {
|
||||
return is_string($rule)
|
||||
? str_replace('update_id', (string) $match_id, $rule)
|
||||
: $rule;
|
||||
}, $rules);
|
||||
}
|
||||
$validator = Validator::make($request->all(), $rules);
|
||||
if ($validator->fails()) {
|
||||
return response()->json($validator->errors(),422);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user