There is a form with the get method, according to which goods are filtered.There is also a paginator that works separately, but approximately according to the same principle.How can we combine the operation of these two filters?

1 Answers 1

paginator is that? And the filter is what?
Of course, it depends on the implementation, in a normal architecture, pageing only determines the current page, it can still determine the number of items per page, almost never has a relationship to requests.
  • Yes, I was a little mistaken, the pagination simply breaks the array into segments.The question was to add filtering parameters to the pagination link, I’m doing it and it works but not correctly(this is a plugin, 'get'=> http_build_query($_GET ))

    <a href="? {{get}}&page={{i}}">{{i}}</a>

    that is, it only works one click, then {{get}} grows like a snowball.
    – Dizzy100 May 18 '19 at 11:22
  • Dizzy100,
    pagination simply breaks an array into segments

    BUT? I correctly understood that you pull out all the records from the base and then chop the array into the necessary segments?
    – Funky58 May 18 '19 at 11:25
  • Funky58, yes
    $orders->slice($perPage *($currentPage - 1), $perPage);
    – Dizzy100 May 18 '19 at 11:31
  • Dizzy100, ok, when you have 100,000 entries, what will you do? Purchase additional server and memory add?
     How about:
    1) Select from the database just what you need(read about LIMIT)
    2) Count the number of items in the database without their complete selection(read about count)
    3) the link selection logic is strange, and how is the paging constructed from it still not visible, besides how do you consider that the pages have ended(I don’t see anywhere the number of items and pages total)?

    that is it only works one click, further {{get}} grows like a snowball.
    So what did you want? Again, you figure the whole gett into the query string(along with all the previous $_GET['page']).It would be nice to add the page number to the gett and put what you need.
    – Funky58 May 18 '19 at 12:00