Ask questions about exporting data using Laravel Excel.
When using customized ExcelExporter for CSV output as shown below, it seems that search condition is not linked to CSV result.
// In grid() method.
$grid->exporter(new \App\Admin\Extensions\UsersExporter());
Since I wanted to link search results with CSV like the standard CSV output function of laravel-admin, I came up with a method to use ExcelExpoter::getData(false) and fromCollection Concern of Laravel Excel.
However, because ExcelExporter originally implements fromQuery , the output will be doubled.
Overriding ExcelExporter::query() , the following implementation was implemented by trial and error so that the query to be returned is given the search condition from the Grid screen.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Versions
Description:
Hello. Thank you for your wonderful package.
Ask questions about exporting data using Laravel Excel.
When using customized ExcelExporter for CSV output as shown below, it seems that search condition is not linked to CSV result.
Since I wanted to link search results with CSV like the standard CSV output function of laravel-admin, I came up with a method to use
ExcelExpoter::getData(false)
andfromCollection
Concern of Laravel Excel.However, because
ExcelExporter
originally implementsfromQuery
, the output will be doubled.Overriding
ExcelExporter::query()
, the following implementation was implemented by trial and error so that the query to be returned is given the search condition from the Grid screen.The above looks like "search results and CSV output" are linked as I expected, but I am wondering if it is the "right way".
Could you tell me if there is another good way? Thank you for reading.