attribute_translations->where('lang', $lang)->first(); return $attribute_translation != null ? $attribute_translation->$field : $this->$field; } public function attribute_translations(){ return $this->hasMany(AttributeTranslation::class); } public function attribute_values() { return $this->hasMany(AttributeValue::class); } }