From 9b896af05395443dec2b85ad63398d3a72838d92 Mon Sep 17 00:00:00 2001 From: Luan Freitas <33601626+luanfreitasdev@users.noreply.github.com> Date: Sat, 11 May 2024 14:47:12 -0300 Subject: [PATCH] Fix Illuminate\Support\Carbon instance in queue (#1542) --- src/Concerns/Filter.php | 4 ++-- src/Exceptions/MissionExportablePackage.php | 23 -------------------- src/Traits/WithExport.php | 24 +++------------------ 3 files changed, 5 insertions(+), 46 deletions(-) delete mode 100644 src/Exceptions/MissionExportablePackage.php diff --git a/src/Concerns/Filter.php b/src/Concerns/Filter.php index 242e81d6..e8450f08 100644 --- a/src/Concerns/Filter.php +++ b/src/Concerns/Filter.php @@ -117,8 +117,8 @@ public function datePickerChanged( $this->addEnabledFilters($field, $label); - $this->filters[$type][$field]['start'] = $startDate; - $this->filters[$type][$field]['end'] = $endDate; + $this->filters[$type][$field]['start'] = $startDate->toString(); + $this->filters[$type][$field]['end'] = $endDate->toString(); $this->filters[$type][$field]['formatted'] = $dateStr; diff --git a/src/Exceptions/MissionExportablePackage.php b/src/Exceptions/MissionExportablePackage.php deleted file mode 100644 index 248e3484..00000000 --- a/src/Exceptions/MissionExportablePackage.php +++ /dev/null @@ -1,23 +0,0 @@ -getPackages($package)}] package to perform this action" - ); - } - - private function getPackages(string $package): string - { - return match ($package) { - 'openspout_v3', 'openspout_v4' => 'openspout/openspout', - default => '' - }; - } -} diff --git a/src/Traits/WithExport.php b/src/Traits/WithExport.php index f2c61dfc..83a033f9 100644 --- a/src/Traits/WithExport.php +++ b/src/Traits/WithExport.php @@ -11,7 +11,7 @@ use PowerComponents\LivewirePowerGrid\Components\Exports\Export; use PowerComponents\LivewirePowerGrid\DataSource\Builder; use PowerComponents\LivewirePowerGrid\Jobs\ExportJob; -use PowerComponents\LivewirePowerGrid\{Exceptions\MissionExportablePackage, Exportable, ProcessDataSource}; +use PowerComponents\LivewirePowerGrid\{Exportable, ProcessDataSource}; use Symfony\Component\HttpFoundation\BinaryFileResponse; use Throwable; @@ -198,32 +198,14 @@ public function prepareToExport(bool $selected = false): Eloquent\Collection|Sup return $processDataSource->transform($results, $processDataSource->component); } - /** - * @throws Throwable - */ public function exportToXLS(bool $selected = false): BinaryFileResponse|bool { - try { - return $this->export(Exportable::TYPE_XLS, $selected); - } catch (\Error) { - $package = config('livewire-powergrid.exportable.default'); - - throw new MissionExportablePackage($package); - } + return $this->export(Exportable::TYPE_XLS, $selected); } - /** - * @throws Throwable - */ public function exportToCsv(bool $selected = false): BinaryFileResponse|bool { - try { - return $this->export(Exportable::TYPE_CSV, $selected); - } catch (\Error) { - $package = config('livewire-powergrid.exportable.default'); - - throw new MissionExportablePackage($package); - } + return $this->export(Exportable::TYPE_CSV, $selected); } /**