So I have a products page where you may browse all products or browse queried products if you choose to. However in both cases they must have pagination. Here is my route:
Route::get('/products/{gender}/{subcategory_name}', [
'uses' => 'ProductsController@showProducts',
'as' => 'products'
]);
For the pagination links I use $model->links()
in my views. Both the pagination and query work. When you decide to query the items you must still paginate them. However when I click to go to the second page the pagination url deletes my query url. The result is loosing the queried products and getting to the second page but with ALL products, not the Queried ones. Here is an step by step walkthrough for clarification:
- I am on this url: products/Men/T-shirt
- I click on the second pagination link so I can get to this url: "products/Men/T-shirt?page=2" // This works
- I decide to query the items. Here is the url afterwards: "products/Men/T-shirt?color%5B%5D=1" // This works. I query the products and get the correct pagination links.
- Now here is the problem. When I click the second pagination link of the queried products the pagination url delets my query url and I go to this link "products/Men/T-shirt?page=2". Now I am on the second page of ALL not the queried products. I need to go to the second page of the QUERIED products.
Solutions and advice are welcome. Thanks in advance!