Raphi
Raphi
FFilament
Created by Raphi on 9/12/2024 in #❓┊help
How can I ensure that only the user's data is exported?
There is a problem with other user data being downloaded. Only the data that really belongs to the user should be downloaded. How can I ensure this? Here is my Exporter Class
class ClientExporter extends Exporter
{
protected static ?string $model = Client::class;

public static function getColumns(): array
{
return [
ExportColumn::make('salutation'),
ExportColumn::make('gender'),
ExportColumn::make('firstname'),
ExportColumn::make('lastname'),
];
}

public static function getCompletedNotificationBody(Export $export): string
{
$body = 'Your client export has completed and ' . number_format($export->successful_rows) . ' ' . str('row')->plural($export->successful_rows) . ' exported.';

if ($failedRowsCount = $export->getFailedRowsCount()) {
$body .= ' ' . number_format($failedRowsCount) . ' ' . str('row')->plural($failedRowsCount) . ' failed to export.';
}

return $body;
}
class ClientExporter extends Exporter
{
protected static ?string $model = Client::class;

public static function getColumns(): array
{
return [
ExportColumn::make('salutation'),
ExportColumn::make('gender'),
ExportColumn::make('firstname'),
ExportColumn::make('lastname'),
];
}

public static function getCompletedNotificationBody(Export $export): string
{
$body = 'Your client export has completed and ' . number_format($export->successful_rows) . ' ' . str('row')->plural($export->successful_rows) . ' exported.';

if ($failedRowsCount = $export->getFailedRowsCount()) {
$body .= ' ' . number_format($failedRowsCount) . ' ' . str('row')->plural($failedRowsCount) . ' failed to export.';
}

return $body;
}
3 replies