title = $product->name; $seoDatum->description = $product->description; return view('front.product', compact('product', 'gamme', 'seoDatum')); } /** * Display a list of products resulting from search query * * @param \Illuminate\Http\Request $request * @return \Illuminate\Contracts\View\View */ public function search(Request $request) { $filter = $request->query('filter'); if (!empty($filter)) { $products = Product::where('is_published', 1) ->where('name', 'like', '%' . $filter . '%') ->get(); } else { $products = Product::where('is_published', 1) ->get(); } $search_title = 'Recherche : ' . $filter; return view('front.search', compact('products', 'search_title', 'filter')); } }