adrema/app/Form/Actions/UpdateParticipantSearchInde...

32 lines
989 B
PHP
Raw Normal View History

<?php
namespace App\Form\Actions;
use App\Form\Models\Form;
use Lorisleiva\Actions\Concerns\AsAction;
class UpdateParticipantSearchIndexAction
{
use AsAction;
public function handle(Form $form): void
{
if (config('scout.driver') !== 'meilisearch') {
return;
}
$form->searchableUsing()->updateIndexSettings(
$form->participantsSearchableAs(),
[
2024-12-12 00:30:59 +01:00
'filterableAttributes' => [...$form->getFields()->filterables()->getKeys(), 'parent-id'],
2024-12-11 22:36:25 +01:00
'searchableAttributes' => $form->getFields()->searchables()->getKeys(),
2024-12-12 01:32:01 +01:00
'sortableAttributes' => [...$form->getFields()->sortables()->getKeys(), 'id'],
2024-12-11 22:36:25 +01:00
'displayedAttributes' => [...$form->getFields()->filterables()->getKeys(), ...$form->getFields()->searchables()->getKeys(), 'id'],
'pagination' => [
'maxTotalHits' => 1000000,
]
]
);
}
}