/** * Get the proper failed validation response for the request. * * @param array $errors * @return \Symfony\Component\HttpFoundation\Response */ public function response(array $errors) { if ($this->ajax() || $this->wantsJson()) { return new JsonResponse($errors, 422); } $properties = $this->mergeProperties(); $selects = ['parent_id_select' => Region::getSelect($this->get('parent_id')), 'shortcut_id_select' => Region::getSelect($this->get('shortcut_id'))]; $input = array_merge($this->except($this->dontFlash), $selects); return $this->redirector->to($this->getRedirectUrl())->withInput($input)->withErrors($errors, $this->errorBag); }