Skip to content

Commit

Permalink
Remove collection
Browse files Browse the repository at this point in the history
  • Loading branch information
mariusdatakrag committed Oct 11, 2023
1 parent 611f873 commit 0d016a2
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions src/Traits/ExportableJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 0d016a2

Please sign in to comment.