public function authenticate()
{
$id = $this->getPayload()->get('sub');
if (! $this->auth->byId($id))
{
return false;
}
return $this->user();
}
protected function authenticated(Request $request, $user)
{
$credentials = $request->only('email', 'password');
try {
if (! $token = JWTAuth::attempt($credentials)) {
echo "Invalid request!";
}
} catch (JWTException $e) {
echo "Could not create a token!";
}
\Cookie::queue('token', $token, 3600);
}
打印$id
时返回到用户表的 id,假设我没有 id 我使用user_id
了如何更改它以及请指导。谢谢