I have this code:
$user = User::where([
['email', '=', $request->email],
['password', '=', bcrypt($request->password)],
])->first();
if(count($user) > 0) {
return response()->json(['access_token' => $user->api_token, 'code' => '202'], 202);
}
else
{
return response()->json(['message' => 'Please provide a valid email or password', 'code' => '200'], 200);
}
But the problem is that it returns that the user does not exist because the password with bcrypt does not match. How can I make that the password that I am inserting and the database match?
Thanks