在使用JWT进行身份验证时,我们如何更改字段名称

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);


    }

When printing $id it return to the id of user's table let say i don't have id I used user_id how can i change this and where please guide. Thanks

byId

byId() will search for primary key so make user_id primary key and make sure it is set for auto increment.