Illuminate\Database\QueryException 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` = App\Model\Good)'
关联:
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、是不是我的关系定义错了?