app/Http/Controllers/UsersController.php
/**
   * Update the specified resource in storage.
   *
   * @param  \Illuminate\Http\Request  $request
   * @param  \App\User  $user
   * @return \Illuminate\Http\Response
   */
Update the specified resource in storage.
Update the specified resource in storage .
public function update(Request $request, User $user)
  {
    $this->validatorUpdate($request);
    $user->name = $request->name;
    $user->email = $request->email;
    if(!empty($request->password))
    {
      $user->password = Hash::make($request->password);
    }
    $user->save();
    return redirect()
      ->route('users.index')
      ->with('success', 'Usuário alterado com sucesso!');
  }
public function update ( Request $ request , User $ user ) { $ this -> validatorUpdate ( $ request ) ; $ user -> name = $ request -> name ; $ user -> email = $ request -> email ; if ( ! empty ( $ request -> password ) ) { $ user -> password = Hash :: make ( $ request -> password ) ; } $ user -> save ( ) ; return redirect ( ) -> route ( 'users.index' ) -> with ( 'success' , 'Usuário alterado com sucesso!') ; }
Update the specified resource in storage.
Update the specified resource in storage .