public function search($keywords)
 {
     $keywords_array = explode(' ', $keywords);
     $results = Product::active()->with('images');
     foreach ($keywords_array as $keyword) {
         $results->Where('name', 'LIKE', '%' . $keyword . '%')->orWhere('description', 'LIKE', '%' . $keyword . '%');
     }
     return Response::json($results->get(), $this->code);
 }
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index(Request $request)
 {
     $search = $request->input('s');
     $products = Product::active()->search($search, 0)->groupBy('id')->orderBy('relevance', 'desc')->get();
     return view('search')->with(['products' => $products]);
 }