From 562b1437f7db43b9103a6e87e46b58f1246c320d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Denis=20Duli=C3=A7i?= Date: Fri, 11 Jun 2021 17:53:42 +0300 Subject: [PATCH] reports not using the new export structure --- app/Abstracts/Report.php | 7 ++++--- app/Exports/Common/Reports.php | 3 +++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/app/Abstracts/Report.php b/app/Abstracts/Report.php index 8fc144afb..48caea891 100644 --- a/app/Abstracts/Report.php +++ b/app/Abstracts/Report.php @@ -16,7 +16,8 @@ use App\Traits\Charts; use App\Traits\DateTime; use App\Traits\SearchString; use App\Utilities\Chartjs; -use Date; +use App\Utilities\Date; +use App\Utilities\Export as ExportHelper; use Illuminate\Support\Str; abstract class Report @@ -205,7 +206,7 @@ abstract class Report public function export() { - return \Excel::download(new Export($this->views['content'], $this), \Str::filename($this->model->name) . '.xlsx'); + return ExportHelper::toExcel(new Export($this->views['content'], $this), $this->model->name); } public function setColumnWidth() @@ -394,7 +395,7 @@ abstract class Report $start = $quarter->getStartDate()->format($this->getQuarterlyDateFormat($this->year)); $end = $quarter->getEndDate()->format($this->getQuarterlyDateFormat($this->year)); - + $formatted_date = $start . '-' . $end; } diff --git a/app/Exports/Common/Reports.php b/app/Exports/Common/Reports.php index 1ce85e7d9..32716f5a2 100644 --- a/app/Exports/Common/Reports.php +++ b/app/Exports/Common/Reports.php @@ -3,12 +3,15 @@ namespace App\Exports\Common; use Illuminate\Contracts\View\View; +use Maatwebsite\Excel\Concerns\Exportable; use Maatwebsite\Excel\Concerns\FromView; use Maatwebsite\Excel\Concerns\ShouldAutoSize; use Maatwebsite\Excel\Concerns\WithTitle; class Reports implements FromView, ShouldAutoSize, WithTitle { + use Exportable; + protected $view; protected $class;