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

32 lines
1003 B
PHP
Raw Permalink 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-16 14:18:02 +01:00
'sortableAttributes' => [...$form->getFields()->sortables()->getKeys(), 'id', 'created_at'],
2024-12-11 22:36:25 +01:00
'displayedAttributes' => [...$form->getFields()->filterables()->getKeys(), ...$form->getFields()->searchables()->getKeys(), 'id'],
'pagination' => [
'maxTotalHits' => 1000000,
]
]
);
}
}