public function getLocale() { if (!isset($this->locale)) { $loc = new Localization(); $this->locale = $loc->getCurrentLocale(); } // if return $this->locale; }
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')); }