Пример #1
0
 public function parentName()
 {
     $categoryLanguages = \App\CategoryLanguage::where('locale', \Lang::getLocale())->where('category_id', $this->parent_id)->first();
     if (!$categoryLanguages) {
         $categoryLanguages = \App\CategoryLanguage::where('locale', 'en')->where('category_id', $this->parent_id)->first();
     }
     return $categoryLanguages ? $categoryLanguages->title : '-';
 }
Пример #2
0
 public function lang()
 {
     $locale = $this->pageLocales()->where('locale', \Lang::getLocale());
     if ($locale->count() > 0) {
         $lang = $locale->first();
         if ($lang->title != '' && $lang->content != '') {
             return $lang;
         }
     }
     return $this->pageLocales()->where('locale', 'en')->first();
 }
Пример #3
0
 public function categoryName()
 {
     if ($this->category) {
         $categoryLanguages = $this->category->categoryLanguages()->where('locale', \Lang::getLocale());
         if ($categoryLanguages->count() > 0) {
             return $categoryLanguages->first()->title;
         } else {
             return $this->category->categoryLanguages()->where('locale', 'en')->first()->title;
         }
     } else {
         return '-';
     }
 }