'required|unique:users', 'first_name' => 'required', 'last_name' => 'required', 'password' => 'required', ]; return $rules; } public function response(Request $request, array $errors) { // TODO: Change the autogenerated stub if(!isset($request->api_secret)) return parent::response($errors); Log::info($errors); foreach($errors as $err) { foreach ($err as $key => $value) { Log::info($err); Log::info($key); Log::info($value); $error['error'] = ['message'=>$value]; $error = json_encode($error, JSON_PRETTY_PRINT); $headers = Utils::getApiHeaders(); return Response::make($error, 400, $headers); } } } }