- How do I add export actions to a Filament table?
- Use the `exportAction()` method in your Filament table definition. For bulk exports, add it to `bulkActions()`, and for header actions, use `headerActions()`. The package provides built-in CSV, XLSX, and PDF export options with preview/print support. Example: `$table->bulkActions([ExportAction::make()])`.
- Which Laravel and Filament versions does this package support?
- The package is compatible with **Filament v5.x** and requires **PHP 8.2+**. For Filament 3.x/4.x, use versions 1.x/2.x respectively. Always check the [compatibility table](https://github.com/jeffersongoncalves/filament-action-export#compatibility) in the README for exact version mappings.
- Can I customize the exported columns or data before export?
- Yes. Use the `modifyQueryUsing()` method to alter the query before export, or override the `getExportedColumns()` method to filter columns. For advanced transformations, use the `modifyExportDataUsing()` callback to manipulate the final dataset.
- How do I handle large datasets (e.g., 50K+ rows) without timeouts?
- The package uses chunking by default (1,000 rows per batch). For larger exports, increase the `chunk_size` in the config or implement custom chunking logic via `modifyQueryUsing()`. Monitor memory usage with Laravel Telescope and consider optimizing queries with `with()` or `select()` to reduce payload size.
- Does this package support PDF customization like headers, footers, or merged cells?
- Basic PDF customization is supported via Blade templates (publish views with `php artisan vendor:publish`). For advanced layouts (e.g., merged cells, custom fonts), you’ll need to extend the package or use external libraries like `dompdf` with custom CSS. The package relies on `dompdf`/`snappy` for PDF generation.
- How do I restrict export actions to specific user roles?
- Use Filament’s built-in authorization system. Wrap the `ExportAction` in a `Gate` or `Policy` check, or leverage Filament’s `canAccessAction()` method. Example: `ExportAction::make()->canAccessAction(fn () => auth()->user()->can('export-data'))`.
- What if I need to export data from a non-Eloquent source (e.g., API responses, collections)?
- The package works with any iterable data (arrays, collections). Pass your custom data to the export action using `exportAction()->modifyExportDataUsing()` or override the `getExportData()` method in your table class to return your desired dataset.
- How do I integrate this with Laravel Mix/Vite for asset compilation?
- The package registers its JS/CSS assets via the `FilamentActionExportServiceProvider`. If using Vite, ensure the `filament-export.js` file is included in your `resources/js/app.js`. For Mix, add it to `webpack.mix.js` and run `npm run dev` or `npm run build`.
- Are there alternatives to this package for Filament exports?
- Yes. For CSV/XLSX, consider `spatie/laravel-excel` (headless, no UI). For PDFs, `barryvdh/laravel-dompdf` offers more control but lacks Filament integration. This package stands out for its **Filament-native UI** (modals, preview) and seamless action integration.
- How do I debug issues like blank exports or corrupted PDFs?
- Start by checking the `filament-action-export.log` for errors. For PDF issues, verify `dompdf`/`snappy` dependencies are installed and fonts are accessible. Use `telescope:clear` and re-test. If using custom templates, ensure Blade views are published and paths are correct.