我如何验证用户并为另一个表中的用户表和密码字段中的用户名字段创建jwt令牌?
$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);
}
我的密码在确认表和密码字段中。与其模型中的确认表相关的用户表。