public function updateUser(EditUserRequest $request)
 {
     Auth::user()->fill(['name' => $request->all()['name'], 'email' => $request->all()['email']]);
     \Auth::user()->save();
     $request->session()->flash('edit_success', trans('home.messages.edit_suceed'));
     return redirect('/');
 }
 /**
  * Update the specified resource in storage.
  *
  * @param  int $id
  * @return Response
  */
 public function update(EditUserRequest $request, $id)
 {
     $this->user->fill($request->all());
     $this->user->save();
     Session::flash('message', 'The user ' . $this->user->full_name . ' have been updated');
     return redirect()->back();
 }
 /**
  * Update the specified resource in storage.
  *
  * @param  int $id
  * @return Response
  */
 public function update(EditUserRequest $request, $id)
 {
     $user = User::findOrFail($id);
     $user->fill($request->all());
     $user->save();
     return redirect()->back();
 }
Exemple #4
0
 /**
  * Update the specified resource in storage.
  *
  * @param  int $id
  * @param EditUserRequest $request
  * @return Response
  */
 public function update($id, EditUserRequest $request)
 {
     $user = User::findOrFail($id);
     $user->fill($request->all());
     $user->save();
     $message = trans('messages.edited_user_successfully');
     Flash::info($message);
     return redirect()->route('admin.users.edit', $user);
 }
Exemple #5
0
 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update(EditUserRequest $request, $id)
 {
     //
     $user = User::findOrFail($id);
     $user->fill($request->all());
     $user->save();
     $redirect = redirect()->route('admin.users.index');
     return $redirect;
 }
Exemple #6
0
 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function putUpdate(Requests\EditUserRequest $request, $id)
 {
     //
     $data = $request->all();
     //	dd($data);
     $user = \App\User::findOrFail($id);
     $user->fill($data);
     $user->save();
     \Session::flash('message_update', 'The methodology [' . $user->first_name . ' ' . $user->last_name . '] with id#' . $user->id . ' was updated');
     return redirect()->back();
 }
 /**
  * Update the specified resource in storage.
  *
  * @param int $id
  * @param EditUserRequest $request
  * @return \Illuminate\Http\RedirectResponse
  */
 public function update($id, EditUserRequest $request)
 {
     $user = User::findOrFail($id);
     $user->fill($request->all());
     $user->save();
     $message = trans('UserManagement::messages.users.update');
     if ($request->ajax()) {
         return $message;
     }
     //\Flash::info($message);
     return redirect()->route('admin.users.index');
 }
 /**
  * Update the specified resource in storage.
  *
  * @param  Request  $request
  * @param  int  $id
  * @return Response
  */
 public function update(Requests\EditUserRequest $request, $id)
 {
     $user = User::findOrfail($id);
     $user->fill($request->all());
     if ($request->password != null) {
         $user->password = bcrypt($request->password);
     }
     dd($user->password);
     $user->save();
     session::flash('message', 'Usuario editado de los registros');
     return redirect()->route('admin.users.index');
 }
 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update(EditUserRequest $request, $id)
 {
     $user = User::findOrFail($id);
     $user->fill($request->all());
     $user->save();
     //Ingresamos la imagen seleccionada nuevamente
     if (\Input::hasFile('file')) {
         //Eliminamos la imagen anterior
         AttachmentController::destroyAllBy('user_id', $user->id);
         $f = \Input::file('file');
         if ($f) {
             $att = new Attachment();
             $att->user_id = $user->id;
             $r = array();
             $r = AttachmentController::uploadAttachment($f, $att);
         }
     }
     return Redirect::to('admin/user')->with('success_message', 'Registro actualizado.');
 }
Exemple #10
0
 public function postEdit(EditUserRequest $request, User $users)
 {
     $data = $request->all();
     $role_id = (int) $data['role'];
     $user_id = $data['user_id'];
     $update = ['firstname' => Str::title($data['firstname']), 'lastname' => Str::title($data['lastname']), 'email' => Str::lower($data['email']), 'phone' => $data['phone'], 'role_id' => $role_id];
     if (!empty($data['password'])) {
         $update['password'] = bcrypt($data['password']);
     }
     $user_update = $users->whereId((int) $user_id)->update($update);
     if ($user_update) {
         $role = Role::find($role_id);
         $users->detachAllRoles();
         $adminUser = $users->find($user_id);
         $adminUser->attachRole($role);
         flash()->success('User Updated Successfully!');
     } else {
         flash()->error('An error occurred, try updating the User again!');
     }
     return redirect()->route('user.list');
 }
 /**
  * Update the specified resource in storage.
  *
  * @param  \App\Http\Requests\EditUserRequest  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(EditUserRequest $request, $id)
 {
     $this->authorize('users-edit');
     $user = User::findOrFail($id);
     $user->update($request->all());
     $roles = empty($request->roles) ? [] : $request->roles;
     $user->roles()->sync($roles);
     return redirect('users');
 }
 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update(Route $route, EditUserRequest $request, $id)
 {
     $pass = '';
     $users = sw_usuario::leftjoin('sw_empleados', 'sw_usuarios.usr_emp_an8', '=', 'sw_empleados.emp_an8')->select('sw_usuarios.*', 'sw_empleados.emp_an8 as emp_an8', 'sw_empleados.*')->findOrFail($route->getParameter('users'));
     //$users= sw_usuario::findOrFail($route->getParameter('users'));
     if ($request->contrasenia == '1') {
         $pass = $this->randomPassword();
         //
         //
         $users->password = $pass;
         $users->usr_flag_pass = '******';
         $users->usr_modificado_por = Auth::user()->usr_name;
         $users->usr_modificado_en = new DateTime();
         $users->fill($request->all());
         $users->save();
         $this->sendMailUpdate($pass, $users);
         Session::flash('message', $users->full_name . ' ' . $pass . ' Se ha modificado en nuestros registros');
         return redirect()->back();
     } else {
         $users->usr_modificado_por = Auth::user()->usr_name;
     }
     $users->usr_modificado_en = new DateTime();
     $users->fill($request->all());
     $users->save();
     Session::flash('message', $users->full_name . ' ' . $pass . ' Se ha modificado en nuestros registros');
     return redirect()->back();
 }
 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update(EditUserRequest $request, $id)
 {
     $this->user->fill($request->all());
     $this->user->save();
     return redirect()->back();
 }
 public function update(EditUserRequest $request, $id)
 {
     $id_user = Auth::user()->id;
     $users = User::findOrFail($id);
     //  if($request->file('photo'))
     //{
     // $file = $request->file('photo');
     // $name = 'Appmm_'.time().'.'.$file->getClientOriginalExtension();
     // $path = public_path().'/upload/users/';
     // $file->move($path,$name);
     //Storage::disk('users')->put($name,  \File::get($file));
     //}
     //    $users->photo=$name;
     $users->iduser_update = $id_user;
     $users->fill($request->all());
     $users->save();
     Session::flash('message', $users->name . ' Se actualizo');
     return redirect()->route('admin.usuarios.index');
 }
 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update(EditUserRequest $request, $id)
 {
     //
     $this->user->fill($request->all());
     $this->user->save();
     return redirect()->route('admin.users.index');
 }
 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id, EditUserRequest $request)
 {
     $vld = User::validate($request->all(), $id);
     if (!$vld->passes()) {
         // dd($vld->errors()->getMessages());
         return Redirect::back()->with('messageNo', $vld->errors()->getMessages()['username'][0]);
     }
     $user = User::find($id);
     $password = '';
     if ($request->password != '') {
         $password = bcrypt($request->password);
     } else {
         $password = $user->password;
     }
     $employee = Employee::find($request->get('employee_id'));
     $user->update(['employee_id' => $request->get('employee_id'), 'fullname' => $employee->lastname . " " . $employee->firstname, 'username' => $request->username, 'password' => $password]);
     $user->attachGroup($request['group_id']);
     return redirect()->route('users.index')->with('messageOk', 'Update user successfully');
 }
Exemple #17
0
 /**
  * Update the specified resource in storage.
  *
  * @param  Request  $request
  * @param  int  $id
  * @return Response
  */
 public function update(EditUserRequest $request, $id)
 {
     $type = $this->findRole($id);
     $data = $request->all();
     $this->user->fill($data);
     $this->user->save();
     if ($data['type'] != $type) {
         $this->user->detachRole($type);
         $this->user->attachRole($data['type']);
     }
     $message = $this->user->full_name . ' ' . trans('admin.users.updated_message');
     Session::flash('success', $message);
     return redirect()->route('admin.users.store');
 }
 /**
  * Update the specified resource in storage.
  *
  * @param  Request  $request
  * @param  int  $id
  * @return Response
  */
 public function update($id, EditUserRequest $request)
 {
     $role = Auth::user()->role_id;
     $user_id = Auth::user()->id;
     if ($role == 3 && $user_id != $id) {
         \Session::flash('message', 'Not Authorized to edit other users profile');
         \Session::flash('message-type', 'danger');
         return redirect('/user/' . $user_id);
     }
     $input = $request->all();
     $users = User::findorFail($id);
     if (isset($input['password'])) {
         $input['password'] = bcrypt($input['password']);
         $users->update($input);
     } else {
         unset($input['password']);
         $users->update($input);
     }
     \Session::flash('message', 'User has been updated!');
     \Session::flash('message-type', 'success');
     return redirect('/user/' . $id);
 }
 public function update(EditUserRequest $request, $id)
 {
     if (Auth::user()->extractUserEmail($id) != $request->input('email')) {
         if ($this->existEmail($request->input('email'))) {
             return redirect()->to('usuarios/' . $id . '/edit')->withInput()->withErrors(array('invalid' => 'El correo electrónico ya ha sido tomado por favor digite otro'));
         }
     }
     if (Auth::user()->extractUserID($id) != $request->input('ID_number')) {
         if ($this->existID($request->input('ID_number'))) {
             return redirect()->to('usuarios/' . $id . '/edit')->withInput()->withErrors(array('invalid' => 'La cédula ya ha sido tomada por favor digite otra'));
         }
     }
     $date = Carbon::now();
     $user = User::findOrFail($id);
     $user->fill($request->all());
     $user->updated_at = $date;
     $user->save();
     return redirect()->route('usuarios.index');
 }
 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update(EditUserRequest $request, $id)
 {
     $user = User::findOrFail($id);
     $user->fill($request->all());
     $user->save();
     Session::flash('message', $user->name . ' was updated !');
     return \Redirect::back();
 }