new export options

This commit is contained in:
2018-07-29 22:07:21 +02:00
parent 8047a0487f
commit 8f76ce3569
7 changed files with 137 additions and 7 deletions
+10 -2
View File
@@ -6,6 +6,14 @@ namespace App\Tables;
class CsvExporter extends BaseExporter
{
private $delimiter = ',';
public function withDelimiter($delimiter)
{
$this->delimiter = $delimiter;
return $this;
}
/**
* @return string - mime type for the downloaded file
*/
@@ -33,7 +41,7 @@ class CsvExporter extends BaseExporter
return $c->title;
}, $this->columns);
fputcsv($handle, $columnNames);
fputcsv($handle, $columnNames, $this->delimiter);
foreach ($this->iterateRows() as $row) {
$items = [];
@@ -44,7 +52,7 @@ class CsvExporter extends BaseExporter
$items[] = null;
}
}
fputcsv($handle, $items);
fputcsv($handle, $items, $this->delimiter);
}
fclose($handle);