jeudi 14 février 2019

Difficulty in changing old email to new email in Laravel

I'm having a difficulty to change the current user's email to a new email which is user input. Here's my controller

public function changeuser(Request $request){
  $id = Auth::user()->id;
  $change_user = User::find($id);
  $change_user->email = $request->input('newuser');
  $change_user->save();

  return redirect('/manageaccount')->with('message', 'email changed successfully');

}

my blade.php which is in modal

<div class="secondea" id="secondea">

             <label><p class="small Montserrat">Enter Old Password</p></label>
            <input type="text" class="form-control small Montserrat" name="oldpass" value="" id="oldpass">

            <label><p class="small Montserrat"> New Password</p></label>
            <input type="text" class="form-control small Montserrat" name="newpass" value="" id="newpass">

            <label><p class="small Montserrat"> Confirm Password</p></label>
            <input type="text" class="form-control small Montserrat" name="confirmpass"
            value="" id="confirmpass">

        </div>

my route

Route::post('/changeuser/','UserController@changeuser');



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire