The simplest would be to just run the query without the pagination, then you would get the desired result.
Aug 15, 2022
4
Level 1
How to export only paginated / filtered data into excel ?
HEllo Devs,
I have millions of companies data into the database. I have applied filters for that data.
So what i want to do is when i apply search filters to that data it gives me data and it is devided into pages. So i want to export only filtered data into excel including paginated data.
suppose I have 1000 records and devided 100 on each page upto 10 then i want to export those 1000 records. How can I do this ?
$query = tbl_company::query();
if ($req->has('state')) {
$query->whereIn('state', $req->input('state'));
}
if ($req->has('district')) {
$query->whereIn('district', $req->input('district'));
}
$data = $query->paginate(100);
return view('/admin/company/index', compact('data',));
Please or to participate in this conversation.