#4751 [coupon-module] Improve UX

This commit is contained in:
diashalabi 2021-10-25 15:03:57 +03:00
parent 7595c0e6ce
commit 5fe010e83f
2 changed files with 13 additions and 0 deletions

View File

@ -129,4 +129,15 @@ class CategoryModel extends CatsCategoryEntryModel implements CategoryInterface
{
return $this->where('parent_category_id', $this->getId())->get();
}
public function scopeWithTrans($query)
{
return $query
->leftJoin('cats_category_translations as cats_trans', function ($join) {
$join->on('cats_category.id', '=', 'cats_trans.entry_id');
$join->whereIn(
'locale', [config('app.locale'), setting_value('streams::default_locale'), 'en']
);
});
}
}

View File

@ -19,4 +19,6 @@ interface CategoryInterface extends EntryInterface
public function setCategoryIconUrl($url);
public function getSubCategories();
public function scopeWithTrans($query);
}