Skip to content

Task : Update Profile Name and Email #213

@masehitam

Description

@masehitam

I'm curious why using
$user = User::find(auth()->user()->id);
is wrong, and
$user = auth()->user();
is right in the unit test

but if I try on browser the method doing exactly the same (Name, email, password changed succesfully)
full code

  // $user = User::find(auth()->user()->id);
  $user = auth()->user();
  $user->name = $request->input('name');
  $user->email = $request->input('email');
  // Also, update the password if it is set
  if ($request->has('password')) {
      $user->password = Hash::make($request->input('password'));
  }
  $user->save();

thanks for the help.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions