Exemplo n.º 1
0
 /**
  * @param                 $user_id
  * @param UserEditRequest $request
  *
  * @return mixed
  */
 public function editUser($user_id, UserEditRequest $request)
 {
     if ($user = User::find($user_id)) {
         $user->update($request->all());
         return $this->respondSuccess('User was successfully updated', ['user' => Fractal::item($user, new UserTransformer())->getArray()]);
     }
     throw new NotFoundHttpException();
 }
Exemplo n.º 2
0
 public function update(UserEditRequest $request, User $user)
 {
     $user->name = $request->get("name");
     $user->email = $request->get("email");
     if ($request->has("password")) {
         $user->password = bcrypt($request->get("password"));
     }
     $user->save();
     return redirect()->route("backend.user.edit", $user->id);
 }
 public function update_user(UserEditRequest $request)
 {
     $id = Auth::id();
     $password = $request->get('old_password');
     if (Auth::attempt(array('id' => $id, 'password' => $password))) {
         $user = User::whereId($id)->firstOrFail();
         $user->first_name = $request->get('first_name');
         $user->last_name = $request->get('last_name');
         $user->dob = $request->get('dob');
         $user->email = $request->get('email');
         $new_password = $request->get('password');
         if ($new_password != "") {
             $user->password = Hash::make($new_password);
         }
         $user->save();
         $calendar = Calendar::where('user_id', '=', $id)->firstOrFail();
         $calendar->name = $request->get('first_name');
         $calendar->save();
         $message = 'valid';
         return $message;
     } else {
         $message = 'invalid';
         return $message;
     }
 }
Exemplo n.º 4
0
 /**
  * Update the specified user in storage.
  *
  * @param  int $id
  * @param UserEditRequest $request
  * @return Response
  */
 public function update($id, UserEditRequest $request)
 {
     $input = $request->only('username', 'email', 'password', 'password_confirmation');
     $this->userRepository->update($id, $input);
     Flash::message('User updated');
     return Redirect()->route('users');
 }
 /**
  * Update the specified user in storage.
  *
  * @param  Request  $request
  * @param  int  $id
  * @return Response
  */
 public function update(UserEditRequest $request, $id)
 {
     $input = $request->all();
     $user = User::findOrFail($id);
     if ($input["password"] == $input["password_confirmation"] && !empty($input["password"])) {
         $input["password"] = bcrypt($input["password"]);
         $user->update($input);
         return redirect('/manage');
     }
     $input['password'] = $user->password;
     $user->update($input);
     return redirect('/manage');
 }
 /**
  * @Put("api/users", as="api.users")
  *
  * @Middleware("jwt.refresh")
  * @Middleware("active")
  *
  * @param UserEditRequest $request
  *
  * @return Response
  */
 public function update(UserEditRequest $request)
 {
     $user = $this->getAuthenticatedUser();
     $updated = $this->userRepository->update($user, $request->all());
     if (!$updated) {
         return $this->respondEntitySavingError('Unable to update user profile');
     }
     return $this->respondEntitySaved('User Profile Updated');
 }
Exemplo n.º 7
0
 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(UserEditRequest $request, $id)
 {
     $usuario = User::findOrFail($id);
     $usuario->fill($request->all());
     $usuario->save();
     $usuario->roles()->sync($request->roles);
     return redirect()->route('usuario.index');
 }