You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
Hi I had the same issue. I dont know the answer but I think that auth() return an Authenticable and find() just an User.
And it seems to make the test happy. Thank you for your question it helped me.
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
thanks for the help.
The text was updated successfully, but these errors were encountered: