Export

You're browsing the documentation for an old version of MoonShine. Consider upgrading your project to MoonShine 2.x.

Exports all data considering filters

use MoonShine\Actions\ExportAction;
 
//...
public function actions(): array
{
return [
ExportAction::make('Export')
// Optional methods
// If you want to run in the background
->queue()
// Selecting a drive
->disk('public')
// Selecting a save directory
->dir('/exports')
// If you want to use csv format
->csv()
// If you use csv
->delimiter(',')
,
];
}
//...

Only fields having a showOnExport flag will be exported

//...
public function fields(): array
{
return [
ID::make()->showOnExport(),
];
}
//...