Files
construprogress/app/Services/Report/ExcelExporter.php
T
Javier Braña 136219f592
Code Style & Quality / Laravel Pint (push) Waiting to run
Code Style & Quality / PHPStan Static Analysis (push) Waiting to run
Code Style & Quality / Test Suite (push) Waiting to run
Code Style & Quality / Browser Tests (Dusk) (push) Waiting to run
feat: Phase 6.2 - Split ReportGenerator into DataAggregator + HtmlExporter + ExcelExporter
- Create DataAggregator service (data aggregation logic)
- Create HtmlExporter service (HTML/preview rendering)
- Create ExcelExporter service (Excel download)
- Refactor ReportGenerator to delegate to services

Tests: 101 passing (319 assertions)
2026-09-01 14:44:11 +02:00

20 lines
566 B
PHP

<?php
namespace App\Services\Report;
use App\Models\Project;
use App\DTO\ReportFilters;
use Maatwebsite\Excel\Facades\Excel;
use App\Exports\ProjectReportExport;
use Symfony\Component\HttpFoundation\BinaryFileResponse;
class ExcelExporter
{
public function export(Project $project, ReportFilters $filters, array $data): BinaryFileResponse
{
$export = new ProjectReportExport($project, $filters, $data);
$filename = 'informe_'.$project->name.'_'.now()->format('Ymd_His').'.xlsx';
return Excel::download($export, $filename);
}
}