Skip to content

Commit 1ecd5a5

Browse files
Update Modules/Projects/Services/ProjectExportService.php
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
1 parent 5e9cfe9 commit 1ecd5a5

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

Modules/Projects/Services/ProjectExportService.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,7 @@ class ProjectExportService
1313
{
1414
public function export(string $format = 'xlsx'): BinaryFileResponse
1515
{
16-
$companyId = session('current_company_id');
17-
$projects = Project::query()->where('company_id', $companyId)->get();
18-
$fileName = 'projects-' . now()->format('Y-m-d_H-i-s') . '.' . ($format === 'csv' ? 'csv' : 'xlsx');
19-
$version = config('ip.export_version', 2);
20-
$exportClass = $version === 1 ? ProjectsLegacyExport::class : ProjectsExport::class;
21-
22-
return Excel::download(new $exportClass($projects), $fileName, $format === 'csv' ? ExcelAlias::CSV : ExcelAlias::XLSX);
16+
return $this->exportWithVersion($format, config('ip.export_version', 2));
2317
}
2418

2519
public function exportWithVersion(string $format = 'xlsx', int $version = 2): BinaryFileResponse

0 commit comments

Comments
 (0)