2024-12-11 22:32:23 +01:00
|
|
|
<?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
|
|
|
|
{
|
2024-12-12 00:50:05 +01:00
|
|
|
if (config('scout.driver') !== 'meilisearch') {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2024-12-11 22:32:23 +01:00
|
|
|
$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'],
|
2024-12-11 22:32:23 +01:00
|
|
|
'pagination' => [
|
|
|
|
'maxTotalHits' => 1000000,
|
|
|
|
]
|
|
|
|
]
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|