The built-in export function of model-grid only implements the export of simple csv format files. If you encounter file coding problems or can not meet your own needs, you can follow the steps below to customize the export function.
Laravel-Excel v3.*
Export support for the Laravel-Excel 3.* First install Laravel-Excel according to the documentation.
With the $columns setting above, only three specified three fields will be exported when exporting. If you want to export all the fields, specify the name of each field in order.
And then create a new custom export class, such as app/Admin/Extensions/ExcelExpoter.php:
<?phpnamespaceApp\Admin\Extensions;useEzadev\Admin\Grid\Exporters\AbstractExporter;useMaatwebsite\Excel\Facades\Excel;classExcelExpoterextendsAbstractExporter{publicfunctionexport() {Excel::create('Filename',function($excel) { $excel->sheet('Sheetname',function($sheet) {// This logic get the columns that need to be exported from the table data $rows =collect($this->getData())->map(function ($item) {returnarray_only($item, ['id','title','content','rate','keywords']); }); $sheet->rows($rows); }); })->export('xls'); }}