From 03748e43115577cb048270815d23d0ee23970c0e Mon Sep 17 00:00:00 2001 From: Samuel De Backer Date: Mon, 8 Nov 2021 15:54:56 +0100 Subject: [PATCH] Some cleaning --- src/Exports/Export.php | 11 ++--------- src/Http/Controllers/AdminController.php | 2 +- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/src/Exports/Export.php b/src/Exports/Export.php index 27509a5..28603ff 100644 --- a/src/Exports/Export.php +++ b/src/Exports/Export.php @@ -16,11 +16,9 @@ class Export implements WithColumnFormatting, ShouldAutoSize, FromCollection, WithHeadings, WithMapping { - protected $collection; - - public function __construct($request) + public function collection() { - $this->collection = QueryBuilder::for(Place::class) + return QueryBuilder::for(Place::class) ->allowedSorts(['id', 'status_translated', 'title_translated']) ->allowedFilters([ AllowedFilter::custom('title', new FilterOr()), @@ -71,9 +69,4 @@ public function columnFormats(): array 'B' => NumberFormat::FORMAT_DATE_DATETIME, ]; } - - public function collection() - { - return $this->collection; - } } diff --git a/src/Http/Controllers/AdminController.php b/src/Http/Controllers/AdminController.php index 6265c7e..45665c7 100644 --- a/src/Http/Controllers/AdminController.php +++ b/src/Http/Controllers/AdminController.php @@ -23,7 +23,7 @@ public function export(Request $request) { $filename = date('Y-m-d').' '.config('app.name').' places.xlsx'; - return Excel::download(new Export($request), $filename); + return Excel::download(new Export(), $filename); } public function create(): View