Skip to content

Commit 98f4030

Browse files
committed
fix
1 parent 654fb82 commit 98f4030

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

src/Forms/Components/SearchableInput.php

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ protected function setUp(): void
2424
$this->extraInputAttributes(['x-model' => 'value']);
2525

2626
$this->registerActions([
27-
Action::make('search')->action(function (SearchableInput $component, array $arguments): array {
27+
Action::make('search')->action(function(SearchableInput $component, array $arguments): array {
2828
if ($component->isDisabled() || $component->isReadOnly()) {
2929
return [];
3030
}
@@ -37,21 +37,23 @@ protected function setUp(): void
3737
]);
3838

3939
$results ??= collect($this->getOptions())
40-
->filter(fn (string $option) => str($option)->contains($search))
40+
->filter(fn(string $option) => str($option)->contains($search))
4141
->toArray();
4242

43-
if (collect($results)->every(fn ($item) => is_string($item))) {
43+
44+
45+
if (collect($results)->every(fn($item) => is_string($item))) {
4446
$results = collect($results)
45-
->map(fn ($item, $key) => [
47+
->map(fn($item, $key) => [
4648
'value' => $key,
4749
'label' => $item,
48-
]);
50+
])->toArray();
4951
}
5052

51-
return $results->toArray();
53+
return $results;
5254
}),
5355

54-
Action::make('item_selected')->action(function ($arguments) {
56+
Action::make('item_selected')->action(function($arguments) {
5557
$this->evaluate($this->onItemSelected, [
5658
'item' => $arguments['item'],
5759
]);

0 commit comments

Comments
 (0)