Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

tnort's avatar
Level 4

Export data after its being filtered using query strings

Hi, I have a page where I can filter data using different filters via query strings.

What I want is to have a button and get to export already filtered data.

I have tried to use an additional query parameter to indicate when I want to export which is set to null by default but when I click the export button it sets the query parameter to 1 which would trigger the export on the backend.

The problem is that when I submit the query with the export flag it hits this line

return Excel::download(new ApplicationsExport($applications->get()), 'applications.xlsx');

Which acts as asynchronous code. It triggers the export, downloads the file and returns back to the previous page but the export flag stays on and the next time when I apply any filter or refresh the page it exports the file again.

So what I want to do is to filter data and then export it.

0 likes
1 reply

Please or to participate in this conversation.