Esempio n. 1
0
 public function postStore(UsersRequest $request = null, $id = "")
 {
     $input = $request->except('save_continue', 'password_confirmation');
     $result = '';
     if (\Input::hasFile('photo')) {
         $photo = (new \ImageUpload($input))->upload();
     }
     if ($id == "") {
         $input['id'] = \Uuid::generate();
         $input['photo'] = isset($photo) ? $photo : "";
         $input['password'] = bcrypt($input['password']);
         $query = $this->model->create($input);
         $result = $query->id;
     } else {
         if (\Input::hasFile('photo')) {
             $input['photo'] = isset($photo) ? $photo : "";
         }
         if (isset($input['password']) && $input['password'] != "") {
             $input['password'] = bcrypt($input['password']);
         }
         $this->model->find($id)->update($input);
         $result = $id;
     }
     $save_continue = \Input::get('save_continue');
     $redirect = empty($save_continue) ? $this->url : $this->url . '/edit/' . $result;
     return redirect($redirect)->with('message', 'Berhasil tambah data Pengguna!');
 }
Esempio n. 2
0
 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update($id, Requests\UsersRequest $request)
 {
     $user = User::findOrFail($id);
     $user->update($request->all());
     return redirect('users');
     //
 }
Esempio n. 3
0
 public function postStore(UsersRequest $request = null, $id = "")
 {
     $input = $request->except('save_continue', 'password_confirmation');
     $result = '';
     if (\Input::hasFile('photo')) {
         $photo = (new \ImageUpload($input))->upload();
     }
     if ($id == "") {
         $input['photo'] = isset($photo) ? $photo : "";
         $input['active'] = $input['active'];
         $input['group_id'] = $input['group_id'];
         $input['created_by'] = \Auth::user()->username;
         $input['password'] = bcrypt($input['password']);
         $query = $this->model->create($input);
         $result = $query->id;
     } else {
         $input['active'] = $input['active'];
         $input['group_id'] = $input['group_id'];
         if (\Input::hasFile('photo')) {
             $input['photo'] = isset($photo) ? $photo : "";
         }
         if (isset($input['password']) && $input['password'] != "") {
             $input['password'] = bcrypt($input['password']);
         }
         $this->model->find($id)->update($input);
         $result = $id;
     }
     $save_continue = \Input::get('save_continue');
     $redirect = empty($save_continue) ? $this->url : $this->url . '/edit/' . $result;
     return redirect($redirect)->with('message', 'Admin saved successfully!');
 }
Esempio n. 4
0
 /**
  * Update the specified resource in storage.
  *
  * @param  Request  $request
  * @param  int  $id
  * @return Response
  */
 public function update($id, UsersRequest $request)
 {
     $user = User::findOrFail($id);
     $user->update($request->all());
     flash()->success('Your user has been updated');
     return redirect()->action('UsersController@edit', $page->id);
 }
Esempio n. 5
0
 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(UsersRequest $request, $id)
 {
     $user = User::find($id);
     $dados = $request->all();
     $dados['password'] = bcrypt($dados['password']);
     $user->update($dados);
     flash()->success('Dados do usuário alterados com sucesso');
     return redirect('/users');
 }
 public function internal_update(UsersRequest $request)
 {
     $oAuth = Auth::user();
     $user = User::find($oAuth->id);
     $user->name = $request->get('name');
     $user->email = $request->get('email');
     $user->phone = $request->get('phone');
     if (!empty($request->get('password'))) {
         $user->password = bcrypt($request->get('password'));
     }
     $user->save();
     return redirect()->route('home');
 }
 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update(UsersRequest $request, $user)
 {
     $user->update($request->all());
     return redirect($user->show_link);
 }
Esempio n. 8
0
 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(UsersRequest $request, $id)
 {
     $user = User::find($id)->fill($request->except('password'));
     if ($request->input('password') != "") {
         $user->password = Hash::make($request->input('password'));
     }
     $user->admin = $request->input('admin', false);
     $user->save();
     return Redirect::route('users.index');
 }
Esempio n. 9
0
 /**
  * Update the specified resource in storage.
  *
  * @param  Request  $request
  * @param  int  $id
  * @return Response
  */
 public function update($id, UsersRequest $request)
 {
     $usuario = \App\User::find($id);
     $usuario->fill($request->all());
     $usuario->Tercero_idTercero = $request['Tercero_idTercero'] == 0 ? null : $request['Tercero_idTercero'];
     $usuario->save();
     return redirect('/users');
 }
Esempio n. 10
0
 /**
  * Update the specified resource in storage.
  *
  * @param UsersRequest|Request $request
  * @param  int $id
  * @return \Illuminate\Http\Response
  */
 public function update(UsersRequest $request, $id)
 {
     $user = User::findOrFail($id);
     if ($request->password) {
         $user->fill(['password' => Hash::make($request->password)])->save();
         $user->update($request->only('name', 'email', 'role', 'active'));
     } else {
         $user->update($request->only('name', 'email', 'role', 'active'));
     }
     $user->roles()->sync([$request->role]);
     return redirect(route('admin.users.index'))->with('success', 'The user has been updated.');
 }