Beartropy Tables

Data & Export
Access table data programmatically and set up export functionality with built-in clipboard support and Laravel Excel integration.

Data Accessors

The Data trait provides methods for accessing your dataset in various states — raw, filtered, or selected.

Available Methods

All Data

  • getAllOriginalData() — Complete dataset with raw database values.
  • getAllData() — Complete dataset with formatting/accessors applied.

Filtered Data

  • getAfterFiltersOriginalData() — Data matching active filters with raw values.
  • getAfterFiltersData() — Data matching active filters with formatting applied.

Selected Data

  • getSelectedOriginalData() — Only user-selected rows with raw values.
  • getSelectedData() — Only user-selected rows with formatting applied.

Single Row & Export

  • getRowByID($id) — Retrieve a single row object by ID.
  • exportToClipboard($collection, $tabs = true) — Copy data to clipboard as TSV (default) or CSV.

1// Original Data (Raw Values)
2$this->getAllOriginalData();
3$this->getAfterFiltersOriginalData();
4$this->getSelectedOriginalData();
5 
6// Formatted Data (With Accessors/Mutators)
7$this->getAllData();
8$this->getAfterFiltersData();
9$this->getSelectedData();
10 
11// Single Row
12$this->getRowByID($id);
13 
14// Export
15$this->exportToClipboard($collection, $tabs = true);

Original vs Formatted

Use "Original" methods when you need raw database values (e.g., for database operations). Use the formatted variants when you need values as they appear in the table (with customData and column transformations applied).

Clipboard Export

Copy table data directly to the user's clipboard.

Bulk Selection IDs

getSelectedRows() — Returns an array of IDs for all currently selected rows. Combine with data accessors for export workflows.

1// Get ID array of selected rows
2$this->getSelectedRows();

Clipboard format

exportToClipboard() copies data as tab-separated values (TSV) by default — perfect for pasting into spreadsheets. Pass $tabs = false for CSV format.

Laravel Excel Integration

Automatic Excel and CSV export when Laravel Excel is installed.

Install Laravel Excel

If Laravel Excel is installed, Beartropy Tables automatically adds "Export to Excel" and "Export to CSV" options to your table's settings dropdown.

1composer require maatwebsite/excel

Zero configuration

Once installed, export features work out-of-the-box using the Data trait's methods. You can customize the export logic by overriding exportToExcel() or exportToCsv() in your table component.
Beartropy Logo

© 2026 Beartropy. All rights reserved.

Provided as-is, without warranty. Use at your own risk.