【发布时间】:2016-12-28 05:28:51
【问题描述】:
我有这张桌子,
categories: id | name | slug
Products: id | name | slug | category_id | brand_id
Brands: id | name | slug |
当我尝试将品牌带入功能类别时出现问题。
类别模型
public function brands()
{
return $this->hasManyThrough('App\Brand', 'App\Product' 'brand_id', 'id');
}
品牌要么没有出现,要么显示在错误的类别中。
还有其他方法可以通过 Brands 产品吗?
【问题讨论】: