SpartnerNL / Laravel-Nova-Excel

🚀 Supercharged Excel exports for Laravel Nova Resources
https://docs.laravel-excel.com/nova/1.0/
MIT License
374 stars 73 forks source link

Enqueue export on demande #134

Open Grafikart opened 2 years ago

Grafikart commented 2 years ago

With the current version it's possible to enqueue action implementing the ShouldQueue interface. But in some case it could be nice to be able to enqueue only if the action is heavy (for instance exporting one row is not queued, but exporting more than 100 rows will be enqueued).

Proposition

A new interface CouldQueue could be used in the Maatwebsite\Excel to choose if the action should be enqueued or not depending on the request or the models.


        if (
            $export instanceof ShouldQueue ||
            ($export instanceof CouldQueue && $export->shouldQueue($request, $models)
        ) {
            return $this->queue($export, $filePath, $diskName, $writerType, $diskOptions);
        }
patrickbrouwers commented 2 years ago

I think it's best to implement this logic yourself as it most likely will entail more logic that what the package can offer.