I have a login/register API and when the user tries to login with the wrong email/password and with credentials that don't exist in the database, they produce the same response which is this:
What I want to do is separate the responses; When the user tries to login with the wrong email/password, 'Invalid Credentials' will be the response and when the user tries to login with credentials that don't exist in the database, the response should be 'User Does Not Exist!'
This is my code in the login controller:
$loginData = $request->validate([
'email' => 'email|required',
'password' => 'required',
]);
if (!auth()->attempt($loginData)) {
return response(['message' => 'Invalid Credentials']);
}
