From fd173889eba15e8c28fb3e6ddf7ddbf07045bbab Mon Sep 17 00:00:00 2001 From: David Bomba Date: Sun, 13 Mar 2016 22:56:44 +1100 Subject: [PATCH] re-working validation --- app/Http/Requests/RegisterRequest.php | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/app/Http/Requests/RegisterRequest.php b/app/Http/Requests/RegisterRequest.php index bf9f7b61f7..7a8a0f9329 100644 --- a/app/Http/Requests/RegisterRequest.php +++ b/app/Http/Requests/RegisterRequest.php @@ -38,16 +38,18 @@ class RegisterRequest extends Request public function response(array $errors) { - //return parent::response($errors); // TODO: Change the autogenerated stub + return parent::response($errors); // TODO: Change the autogenerated stub Log::info($errors); - - foreach($errors as $err) { - $error['error'] = $err; - $error = json_encode($error, JSON_PRETTY_PRINT); - $headers = Utils::getApiHeaders(); - return Response::make($error, 400, $headers); + foreach($errors as $err) { + foreach ($err as $key => $value) { + $error['error'] = $value; + $error = json_encode($error, JSON_PRETTY_PRINT); + $headers = Utils::getApiHeaders(); + + return Response::make($error, 400, $headers); + } } } }