public function translation($language = null) { if ($language == null) { $language = App::getLocale(); } return $this->hasMany('App\\CategoryTranslation')->where('language_id', '=', $language); }
public function translationCompanyInformation($language = null) { if ($language == null) { $language = App::getLocale(); } if ($language == 'kh') { return $this->getAttribute('company_information_kh'); } elseif ($language == 'ch') { return $this->getAttribute('company_information_ch'); } else { return $this->getAttribute('company_information'); } }
public function getInfo($page_name) { // $get_current_lang_id = Lang::getCurrentLangId(); $current_lang_name = App::getLocale(); return Page::where('name', '=', $page_name)->first()->langs->getByName($current_lang_name)->pageInfo(); }
public function getCurrentLangId() { $lang_code_name = App::getLocale(); return Lang::getByName($lang_code_name)->id; }