update lock clucknut
All checks were successful
All checks were successful
This commit is contained in:
0
vendor/maatwebsite/excel/src/Console/ExportMakeCommand.php
vendored
Normal file → Executable file
0
vendor/maatwebsite/excel/src/Console/ExportMakeCommand.php
vendored
Normal file → Executable file
0
vendor/maatwebsite/excel/src/Console/ImportMakeCommand.php
vendored
Normal file → Executable file
0
vendor/maatwebsite/excel/src/Console/ImportMakeCommand.php
vendored
Normal file → Executable file
2
vendor/maatwebsite/excel/src/Exporter.php
vendored
2
vendor/maatwebsite/excel/src/Exporter.php
vendored
@@ -27,7 +27,7 @@ public function download($export, string $fileName, ?string $writerType = null,
|
||||
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||
* @throws \PhpOffice\PhpSpreadsheet\Writer\Exception
|
||||
*/
|
||||
public function store($export, string $filePath, ?string $disk = null, ?string $writerType = null, $diskOptions = []);
|
||||
public function store($export, string $filePath, ?string $diskName = null, ?string $writerType = null, $diskOptions = []);
|
||||
|
||||
/**
|
||||
* @param object $export
|
||||
|
||||
@@ -22,11 +22,12 @@ class WriterFactory
|
||||
* @param string $writerType
|
||||
* @param Spreadsheet $spreadsheet
|
||||
* @param object $export
|
||||
* @param string|null $filePath
|
||||
* @return IWriter
|
||||
*
|
||||
* @throws \PhpOffice\PhpSpreadsheet\Writer\Exception
|
||||
*/
|
||||
public static function make(string $writerType, Spreadsheet $spreadsheet, $export): IWriter
|
||||
public static function make(string $writerType, Spreadsheet $spreadsheet, $export, ?string $filePath = null): IWriter
|
||||
{
|
||||
$writer = IOFactory::createWriter($spreadsheet, $writerType);
|
||||
|
||||
@@ -45,6 +46,11 @@ public static function make(string $writerType, Spreadsheet $spreadsheet, $expor
|
||||
if ($writer instanceof Csv) {
|
||||
static::applyCsvSettings(config('excel.exports.csv', []));
|
||||
|
||||
// Auto-detect TSV files and apply tab delimiter
|
||||
if ($filePath && static::isTsvFile($filePath) && !($export instanceof WithCustomCsvSettings)) {
|
||||
static::applyCsvSettings(['delimiter' => "\t"]);
|
||||
}
|
||||
|
||||
if ($export instanceof WithCustomCsvSettings) {
|
||||
static::applyCsvSettings($export->getCsvSettings());
|
||||
}
|
||||
@@ -89,4 +95,16 @@ private static function includesCharts($export): bool
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $filePath
|
||||
* @return bool
|
||||
*/
|
||||
private static function isTsvFile(string $filePath): bool
|
||||
{
|
||||
$pathInfo = pathinfo($filePath);
|
||||
$extension = strtolower($pathInfo['extension'] ?? '');
|
||||
|
||||
return $extension === 'tsv';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ public function handle(Writer $writer)
|
||||
}
|
||||
|
||||
// Write to temp file with empty sheets.
|
||||
$writer->write($sheetExport, $this->temporaryFile, $this->writerType);
|
||||
$writer->write($this->export, $this->temporaryFile, $this->writerType);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
3
vendor/maatwebsite/excel/src/Writer.php
vendored
3
vendor/maatwebsite/excel/src/Writer.php
vendored
@@ -172,7 +172,8 @@ public function write($export, TemporaryFile $temporaryFile, string $writerType)
|
||||
$writer = WriterFactory::make(
|
||||
$writerType,
|
||||
$this->spreadsheet,
|
||||
$export
|
||||
$export,
|
||||
$temporaryFile->getLocalPath()
|
||||
);
|
||||
|
||||
if ($temporaryFile instanceof RemoteTemporaryFile && !$temporaryFile->existsLocally() && !$this->isRunningServerless()) {
|
||||
|
||||
Reference in New Issue
Block a user