charlieBrown's avatar

How to add a button to filter results of pagination

I have followed a tutorial online to build a pagination page but it didn't had anything related to the button. I have made a button to orderBy some fields but when the button is clicked it appends to the end of the URL the &orderBy=<filter> and it keeps adding.

HTML code

Ordenar por: <a href="{{ Request::url() }}?{{ Request::getQueryString() }}&orderBy=preco_hora">€/h</a> | <a href="{{ Request::url() }}?{{ Request::getQueryString() }}&orderBy=stars">evaluation</a> |

If I click the €/ht orders by the correct order: `?distrito=Aveiro&profissao=Advogado&orderBy=preco_ho. But if I click at `evaluati it appends to the ` UR : `?distrito=Aveiro&orderBy=preco_hora&profissao=Advogado&orderBy=sta. It's working but I wouldn't like to appear this long string after clicking another filter. I would like to replace `orderBy=preco_ho for `orderBy=sta and not have two `order.

Any suggestion or any Laravel method to help me?

0 likes
2 replies
charlieBrown's avatar

@aurawindsurfing Thank you for the suggestion but it doesn't make much sense to me. The dataset I'll be searching is not large. No point in using Algolia.

Please or to participate in this conversation.