how can i authenticate user and create jwt token for that with username field in users table and password fields in another table ?
$credentials = [
'phone' => $request->phone,
'confirm.password' => $request->confirmation_code,
];
try {
// attempt to verify the credentials and create a token for the user
if (! $token = JWTAuth::attempt($credentials)) {
return response()->json(['state' => False, 'error' => 'Invalid Credentials.'], 401);
}
} catch (JWTException $e) {
// something went wrong whilst attempting to encode the token
return response()->json(['state' => False, 'error' => 'can not create token !'], 500);
}
my password is in confirm table and password field. the user table in related to confirm table in thier model.