fix: pc header修复产品分类关联推荐产品未过滤已禁用的
Some checks failed
Gitea Actions Official-website / deploy-dev (push) Failing after 3s
Some checks failed
Gitea Actions Official-website / deploy-dev (push) Failing after 3s
This commit is contained in:
@@ -93,7 +93,7 @@ abstract class Common extends BaseController
|
|||||||
])
|
])
|
||||||
->when($with_recommends, function($query) {
|
->when($with_recommends, function($query) {
|
||||||
$query->with(['recommends' => function($query) {
|
$query->with(['recommends' => function($query) {
|
||||||
$query->field(['id', 'category_id', 'title', 'image', 'desc', 'link'])
|
$query->field(['id', 'category_id', 'title', 'image', 'desc', 'link'])->disabled(false)
|
||||||
->order(['sort' => 'asc', 'id' => 'desc']);
|
->order(['sort' => 'asc', 'id' => 'desc']);
|
||||||
}]);
|
}]);
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -22,4 +22,9 @@ class ProductCategoryRecommendModel extends ProductCategoryRecommendBaseModel
|
|||||||
{
|
{
|
||||||
$query->where($this->getTable() . '.language_id', '=', $language);
|
$query->where($this->getTable() . '.language_id', '=', $language);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function scopeDisabled($query, $disabled = true)
|
||||||
|
{
|
||||||
|
$query->where($this->getTable() . '.disabled', '=', (int)$disabled);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user