I'm returning LengthAwarePaginator to AJAX success and displaying it like this:
$.ajax({
url: 'getLawsByFiltersElastic/0/' + types + '/' + years + '/' + keywords + '/' + result,
type: 'POST',
success: function (result) {
$("#law").empty();
$.each( result.data, function( index, value ){
$("#law").append(result.data[index].law_number);
$("#law").append(result.data[index].law_year);
});
}
});
My controller is like this:
$page = Input::get('page', 1);
$perPage = 10;
$offset = ($page * $perPage) - $perPage;
$paginator = new Pagination\LengthAwarePaginator(array_slice($result, $offset, $perPage, true), count($laws), $perPage, $page, ['path' => $request->url(), 'query' => $request->query()]);
return $paginator;
It displays only first page (10 records). I don't know how to display render links below data. Is there an easy solution?