I have just started with Laravel and I am trying to make a search function with proper pagination. The function works for page one but on pag
If you want to apply filters to the next page you should add them to your paginator like this:
$product = Product::where('naam', 'LIKE', '%' . $q . '%')
->orWhere('beschrijving', 'LIKE', '%' . $q . '%')
->paginate(6);
$product->appends(['search' => $q]);
And change your route from post to get:
Route::get('search', 'IndexController@search');