diff --git a/src/DataSource/Builder.php b/src/DataSource/Builder.php index c9daf4e6..62006eeb 100644 --- a/src/DataSource/Builder.php +++ b/src/DataSource/Builder.php @@ -39,7 +39,11 @@ public static function make( public function filter(): EloquentBuilder|QueryBuilder { - $filters = collect($this->component->filters); + $filters = collect( + app()->runningInConsole() + ? $this->component->filters + : $this->component->filters() + ); if ($filters->isEmpty()) { return $this->query; diff --git a/src/Traits/WithExport.php b/src/Traits/WithExport.php index 37a90d82..374c4ffc 100644 --- a/src/Traits/WithExport.php +++ b/src/Traits/WithExport.php @@ -54,17 +54,19 @@ public function getExportBatchProperty(): ?Batch public function updateExportProgress(): void { - if (!is_null($this->exportBatch)) { - $this->batchFinished = $this->exportBatch->finished(); - $this->batchProgress = $this->exportBatch->progress(); - $this->batchErrors = $this->exportBatch->hasFailures(); + if (is_null($this->exportBatch)) { + return; + } - if ($this->batchFinished) { - $this->batchExporting = false; - } + $this->batchFinished = $this->exportBatch->finished(); + $this->batchProgress = $this->exportBatch->progress(); + $this->batchErrors = $this->exportBatch->hasFailures(); - $this->onBatchExecuting($this->exportBatch); + if ($this->batchFinished) { + $this->batchExporting = false; } + + $this->onBatchExecuting($this->exportBatch); } public function downloadExport(string $file): BinaryFileResponse