Grab page limit from scout config
This commit is contained in:
parent
b1581bf9c8
commit
30d670a575
|
@ -6,6 +6,7 @@ use App\Member\FilterScope;
|
|||
use App\Member\Member;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Laravel\Scout\EngineManager;
|
||||
use League\Csv\Writer;
|
||||
use Lorisleiva\Actions\ActionRequest;
|
||||
use Lorisleiva\Actions\Concerns\AsAction;
|
||||
|
@ -43,7 +44,7 @@ class ExportAction
|
|||
|
||||
public function asController(ActionRequest $request): StreamedResponse
|
||||
{
|
||||
$members = FilterScope::fromRequest($request->input('filter'))->withOptions(['hitsPerPage' => 20000])->getQuery()->get();
|
||||
$members = FilterScope::fromRequest($request->input('filter'))->noPageLimit()->getQuery()->get();
|
||||
$contents = $this->handle($members);
|
||||
|
||||
Storage::disk('temp')->put('mitglieder.csv', $contents);
|
||||
|
|
|
@ -59,6 +59,13 @@ class FilterScope extends ScoutFilter
|
|||
return $this;
|
||||
}
|
||||
|
||||
public function noPageLimit(): self
|
||||
{
|
||||
return $this->withOptions([
|
||||
'hitsPerPage' => config('scout.meilisearch.index-settings.' . Member::class . '.pagination.maxTotalHits')
|
||||
]);
|
||||
}
|
||||
|
||||
public function getQuery(): Builder
|
||||
{
|
||||
$this->search = $this->search ?: '';
|
||||
|
|
Loading…
Reference in New Issue