all(); $rules = array_keys($this->rules()); $final_data = []; if (!empty($rules)) { foreach ($rules as $rule) { if (isset($request[$rule])) { $final_data[$rule] = $request[$rule]; } } } $this->replace($final_data); } protected function failedValidation(Validator $validator) { $errors = (new ValidationException($validator))->errors(); throw new HttpResponseException($this->sendApiResponse($errors,"validation error",config('constant.API_VALIDATION_FAILED'))); } }