Maybe it is a bug on relation language in model BinshopsCategoryTranslation?
GeneratorEVil opened this issue · comments
generatorevil commented
Hello! I want to get all categories by locale. I try to
$categories = BinshopsCategoryTranslation::whereHas('language', function($q){
$q->where('locale', app()->getLocale());
})->get();
And get error
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'binshops_languages.lang_id' in 'where clause'
When i change a relation language on model BinshopsCategoryTranslation to
public function language()
{
return $this->hasOne(BinshopsLanguage::class,"id","lang_id");
}
Then i get collection of Categories with name by current locale.
dd($categories[0]->category_name); // Show name