/** * Store a new user in the database. * * @return \Illuminate\Http\JsonResponse */ public function store() { try { $user = $this->users->create($this->input()); return $this->jsonResponse(['user' => $user]); } catch (ValidationException $e) { return $this->error($e->getMessageBag()); } }
/** * Store a new user in the database. * * @return \Illuminate\Http\RedirectResponse */ public function store() { $input = $this->input(); try { $user = $this->users->create($input); return $this->redirect('edit', [$user->id])->with('success', Lang::get('c::user.create-success')); } catch (ValidationException $e) { return $this->redirect('create')->withErrors($e)->withInput(); } }