Example #1
0
 public function show(Request $request)
 {
     if (!$request->has('q')) {
         return redirect('/' . LANG);
     }
     $params = $request->only('q');
     $searchParams = explode(" ", trim($params['q']));
     $productsResults = Product::search($searchParams);
     $portfoliosResults = Portfolio::search($searchParams);
     $newsResults = News::search($searchParams);
     $tendersResults = Tender::search($searchParams);
     $vacanciesResults = Vacancy::search($searchParams);
     $sharesResults = Share::search($searchParams);
     $experEdvicesResults = ExpertAdvice::search($searchParams);
     $count = count($productsResults) + count($portfoliosResults) + count($newsResults) + count($tendersResults) + count($vacanciesResults) + count($sharesResults) + count($experEdvicesResults);
     return view('search', ['products' => $productsResults, 'portfolios' => $portfoliosResults, 'news' => $newsResults, 'tenders' => $tendersResults, 'vacancies' => $vacanciesResults, 'shares' => $sharesResults, 'experEdvices' => $experEdvicesResults, 'count' => $count, 'title' => LANG . '_title', 'description' => LANG . '_description', 'adderss' => LANG . '_adderss', 'type' => 'news']);
 }