1 回答
TA贡献1831条经验 获得超4个赞
改变这个
public function getProductFromIdCategories($categories)
{
return $this->model->select('name', 'slug', 'products.id', 'small_description')
->with(['selectedCategory', 'frontImage', 'selectedCategory' => function($q) use ($categories){
$q->whereIn('category_id', $categories);
}])->whereIn('category_id', $categories)->active()->get();
}
在此
public function getProductFromIdCategories($categories)
{
return $this->model->select('name', 'slug', 'products.id', 'small_description')
->with(['frontImage', 'selectedCategory'])
->whereHas('selectedCategory', function ($q) use($categories) {
$q->whereIn('category_id', $categories);
})->active()->get();
}
- 1 回答
- 0 关注
- 73 浏览
添加回答
举报