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;