public function index(Request $request)
	{
		//filter products by the given query.
		$response['products']['results'] = $this->products->filter([
			'search' => $request->get('q')
		], 4)->get();

		//filter categories by the given query.
		$response['products']['categories'] = app('category.repository.cahe')->categoriesWithProducts([
			'name' => $request->get('q'),
			'description' => $request->get('q'),
		], 4, ['id', 'name']);

		$response['products']['suggestions'] = Suggestions\Suggest::for('my_searches')->shake()->get('my_searches');

		$response['products']['categories_title'] = trans('globals.suggested_categories');
        $response['products']['suggestions_title'] = trans('globals.suggested_products');
        $response['products']['results_title'] = trans('globals.searchResults');

		return $response;
	}
public function index(Request $request)
	{
		//filter products by the given query.
		$response['products']['results'] = $this->products->filter([
			'search' => $request->get('q')
		], 4)->get();

		//filter categories by the given query.
		$response['products']['categories'] = app('category.repository.cahe')->categoriesWithProducts([
			'name' => $request->get('q'),
			'description' => $request->get('q'),
		], 4, ['id', 'name']);

		$response['products']['suggestions'] = Suggestions\Suggest::for('my_searches')->shake()->get('my_searches');

		$response['products']['categories_title'] = trans('globals.suggested_categories');
        $response['products']['suggestions_title'] = trans('globals.suggested_products');
        $response['products']['results_title'] = trans('globals.searchResults');

		return $response;
	}
public function index ( Request $ request ) { //filter products by the given query. $ response [ 'products' ] [ 'results' ] = $ this -> products -> filter ( [ 'search' => $ request -> get ( 'q' ) ] , 4 ) -> get ( ) ; //filter categories by the given query. $ response [ 'products' ] [ 'categories' ] = app ( 'category.repository.cahe' ) -> categoriesWithProducts ( [ 'name' => $ request -> get ( 'q' ) , 'description' => $ request -> get ( 'q' ) , ] , 4 , [ 'id' , 'name' ] ) ; $ response [ 'products' ] [ 'suggestions' ] = Suggestions \ Suggest :: for ( 'my_searches' ) -> shake ( ) -> get ( 'my_searches' ) ; $ response [ 'products' ] [ 'categories_title' ] = trans ( 'globals.suggested_categories' ) ; $ response [ 'products' ] [ 'suggestions_title' ] = trans ( 'globals.suggested_products' ) ; $ response [ 'products' ] [ 'results_title' ] = trans ( 'globals.searchResults' ) ; return $ response ; }
Loads the products search.

@return void
Loads the products search .