I am working with laravel vue and algolia. Everything working fine except the pagination properly. The pagination is working but only it shows the fisrt page result. When i click 2,3... pages link of pagination button it doesn't fetch the next page result. What i have done are given below:
SearchController.php
public function search(Request $request)
{
$error = ['error' => 'No results found, please try with different keywords.'];
if($request->has('q')) {
$movies = Movie::search($request->get('q'))->get();
return $movies ? $movies : $error;
}
return $error;
}
Pagination.js
var search = instantsearch({
appId: 'myid',
apiKey: 'mykey',
indexName: 'myindex',
urlSync: true
});
search.addWidget(
instantsearch.widgets.pagination({
container: '#pagination-container',
maxPages: 20,
scrollTo: false
})
);
search.start();