making

2461 经验值

IlluminateDatabaseQueryException with message 'SQLSTATE[42S22]: Column not found: 1054 Unknown column 'goods_keywordables.goods_keyword_id' in 'field list' (SQL: select goods.*, goods_keywordables.goods_keyword_id as pivot_goods_keyword_id, goods_keywordables.goods_keywordable_id as pivot_goods_keywordable_id from goods inner join goods_keywordables on
goods.goods_id = goods_keywordables.goods_keywordable_id where goods_keywordables.goods_keyword_id = 1 and `goods_k
eywordables.goods_keywordable_type` = AppModelGood)'

关联:
public function goods_keywords()

{
    return $this->morphToMany('App\Model\Goods_keyword', 'goods_keywordable');
}

public function goods()

{
    return $this->morphedByMany('App\Model\Good', 'goods_keywordable');
}

}
1、其中goods_keywordables.goods_keyword_id 报错这个字段在中间关联表是不存在的,可是生成的SQL 为什么会有这个字段?
2、是不是我的关系定义错了?

private function getUserByToken($accessToken)

{
    $heades = ['Authorization' => 'Bearer' . $accessToken];
    $request = new \GuzzleHttp\Psr7\Request('GET', 'http://192.168.254.128/api/user', $heades);
    $response = $this->http->send($request);
    dd($response);
    return json_decode((string)$response->getBody(), true);

}

哥们,我也遇到一样的问题,请问怎么解决的呢。。求教~~