new export options
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user