/** * Display a listing of the resource. * * @param Request $request * @param $category * @return Response */ public function index(Request $request) { $search = array_add($request->all(), 'published', [1, 4]); $products = $this->productRepository->getall($search); $q = isset($search['q']) ? $search['q'] : ''; return view('products.index')->with(compact('products', 'q')); }