/** * Update the specified resource in storage. * * @param int $id * @return Response */ public function update($id, AdminUsersEditFormRequest $request) { $user = $this->user->find($id); if (!$request->has("password")) { $input = $request->only('email', 'first_name', 'last_name'); $user->fill($input)->save(); $this->user->updateRole($id, $request->input('account_type')); return redirect()->route('admin.profiles.edit', $user->id)->withFlashMessage('User has been updated successfully!'); } else { $input = $request->only('email', 'first_name', 'last_name', 'password'); $user->fill($input); $user->password = \Hash::make($request->input('password')); $user->save(); $this->user->updateRole($id, $request->input('account_type')); return redirect()->route('admin.profiles.edit', $user->id)->withFlashMessage('User (and password) has been updated successfully!'); } }
/** * Update the specified resource in storage. * * @param int $id * @return Response */ public function update($id, AdminUsersEditFormRequest $request) { $user = $this->user->find($id); if (!$request->has("password")) { $input = $request->only('email', 'first_name', 'last_name'); // $this->adminUsersEditForm->excludeUserId($user->id)->validate($input); // $input = array_except($input, ['account_type']); $user->fill($input)->save(); $this->user->updateGroup($id, $request->input('account_type')); return redirect()->route('admin.profiles.edit', $user->id)->withFlashMessage('User has been updated successfully!'); } else { $input = $request->only('email', 'first_name', 'last_name', 'password'); // $this->adminUsersEditForm->excludeUserId($user->id)->validate($input); // $input = array_except($input, ['account_type', 'password_confirmation']); $user->fill($input)->save(); $user->save(); $this->user->updateGroup($id, $request->input('account_type')); return redirect()->route('admin.profiles.edit', $user->id)->withFlashMessage('User (and password) has been updated successfully!'); } }