我在Laravel中对REST API进行了简单的Auth登录,但是结果始终在第一个if语句中,这是怎么回事?
public function login(Request $request, User $user)
{
if (!Auth::attempt(['email' => $request->email, 'password' => $request->password])) {
return response()->json(['Error' => 'Email atau Password yang kamu masukan salah'], 401);
}
$user = $user->find(Auth::user()->id);
return response()->json($user, 200);
}