From 0d016a2034158e82b9e99a593aed4fd3bb0e5411 Mon Sep 17 00:00:00 2001 From: Marius Odendaal Date: Wed, 11 Oct 2023 16:51:37 +0200 Subject: [PATCH] Remove collection --- src/Traits/ExportableJob.php | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/src/Traits/ExportableJob.php b/src/Traits/ExportableJob.php index 38eb92c7..1ade2f6d 100644 --- a/src/Traits/ExportableJob.php +++ b/src/Traits/ExportableJob.php @@ -37,20 +37,10 @@ public function prepareToExport(): Eloquent\Collection|Collection { $processDataSource = tap(ProcessDataSource::fillData($this->componentTable), fn($datasource) => $datasource->get()); - $inClause = $processDataSource->component->filtered; + $inClause = $processDataSource?->component?->filtered ?? []; $this->componentTable->filters = $this->filters ?? []; - if ($processDataSource->isCollection) { - if ($inClause) { - $results = $processDataSource->get()->whereIn($this->componentTable->primaryKey, $inClause); - - return $processDataSource->transform($results); - } - - return $processDataSource->transform($processDataSource->resolveCollection()); - } - /** @phpstan-ignore-next-line */ $currentTable = $processDataSource->component->currentTable;