Export data

Good evening, I have the following code to export the documentation to Excel. https://filamentphp.com/docs/3.x/actions/prebuilt-actions/export It downloads it to the pulic folder. but I don't want it to store but rather download normally in the download folder. Export action - Actions - Filament ExportBulkAction::make() ->exporter(OperationExporter::class) ->formats([ ExportFormat::Xlsx ]) ->maxRows(1000)
1 Reply
Zen
Zen8mo ago
The request here. Basically, it use Queue and will notify in the Notification. Then you can download from Notification. For me, I clean previous exported files and data from DB using this. ` protected function getHeaderActions(): array { return [ Actions\CreateAction::make()->disabled(!PropertyResource::handleVersion()) ->label( fn (): string => PropertyResource::handleVersion() ? 'Create property' : 'Reach demo limit (5 properties)' )->icon('heroicon-o-plus')->keyBindings(['mod+n']), Actions\ExportAction::make()->disabled(!PropertyResource::handleVersion()) ->exporter(PropertyExporter::class) ->columnMapping(false) ->formats([ ExportFormat::Xlsx, ])->label('Export')->color('success') ->icon('carbon-document-export')->keyBindings(['mod+e']) ->before(function () { $this->deleteOldExports(); }), ]; } private function deleteOldExports() { $exports = Export::where('exporter', PropertyExporter::class)->get(); foreach ($exports as $export) { $path = 'filament_exports/' . $export->id; if (Storage::disk('public')->exists($path)) { Storage::disk('public')->deleteDirectory($path); } $export->delete(); } }
Want results from more Discord servers?
Add your server