/** * Process a registration attempt. * * @return \Illuminate\Http\JsonResponse */ public function attemptRegistration() { try { $user = $this->users->register($this->input()); $data = ['status' => 'registered', 'user' => $user]; return $this->jsonResponse($data, 200); } catch (ValidationException $e) { return $this->error($e->getErrors()); } catch (ActivationException $e) { if ($this->debug) { throw $e; } return $this->error(['registration failed, please try again later']); } }
/** * Process a registration attempt. * * @return \Illuminate\Http\RedirectResponse */ public function attemptRegistration() { $input = $this->input(); try { $this->users->register($input); return $this->redirect('login')->with('success', Lang::get('c::auth.register-success')); } catch (ValidationException $e) { return $this->redirect('register')->withErrors($e->getErrors())->withInput(); } catch (ActivationException $e) { if ($this->debug) { throw $e; } return $this->redirect('register')->with('error', Lang::get('c::auth.activation-failed')); } }