/** * @param Exporter $exporter * * @return void */ public function handle(Exporter $exporter) { $params = $exporter->getParams(); $this->setProject($exporter->getParams('route.project')); $query = $this->project->issues()->select(array_keys($this->columns)); // Filter issues $this->project->filterTitleOrBody($query, $params['keyword']); $this->project->filterAssignTo($query, $params['keyword']); $this->project->filterTitleOrBody($query, $params['keyword']); // Fetch issues $this->issues = $query->get(); // Create CSV file $exporter->sheet($this->project->name, function (LaravelExcelWorksheet $sheet) { // Global sheet styles $this->globalStyle($sheet); // Title $sheet->mergeCells('A1:G1'); $sheet->setHeight(1, 50); $sheet->cell('A1', function (CellWriter $cell) { $this->sheetTitle($cell); }); // Header $sheet->row(2, array_map('trans', $this->header)); // Rows $index = 3; foreach ($this->issues as $issue) { $this->sheetRow($sheet, $index, $issue); ++$index; } }); }