public function getLocale()
 {
     if (!isset($this->locale)) {
         $loc = new Localization();
         $this->locale = $loc->getCurrentLocale();
     }
     // if
     return $this->locale;
 }
Example #2
0
 public function search(Request $request)
 {
     $query = $request->get('q');
     $title = 'Search Results';
     if (\Localization::getCurrentLocale() == 'id') {
         $results = Post::search($query, ['title_id' => 10, 'content_id' => 5])->get();
     } else {
         $results = Post::search($query, ['title_en' => 10, 'content_en' => 5])->get();
     }
     return view('search', compact('title', 'query', 'results'));
 }