Updating state after filtering
Cant find out if it's currently possible, where after filtering, I update the state and tooltip of values.
When I filter a different language, I want to update the fields with the translations, and add a tooltip with the originals
Filter::make('languages')
->form([
Select::make('locale')
->options(Locales::all()->pluck('title', 'locale'))
->selectablePlaceholder(false),
])
->query(function (Builder $query, array $data): Builder {
return $query
->when(
$data['locale'],
function (Builder $query, $state) {
if ($state == null || $state == "en") {
return $query;
}
return $query->whereHas('locales', fn (Builder $query) => $query->where('locales_offer.locale', $state));
}
);
}), Filter::make('languages')
->form([
Select::make('locale')
->options(Locales::all()->pluck('title', 'locale'))
->selectablePlaceholder(false),
])
->query(function (Builder $query, array $data): Builder {
return $query
->when(
$data['locale'],
function (Builder $query, $state) {
if ($state == null || $state == "en") {
return $query;
}
return $query->whereHas('locales', fn (Builder $query) => $query->where('locales_offer.locale', $state));
}
);
}),When I filter a different language, I want to update the fields with the translations, and add a tooltip with the originals