Creatinga a new option in select

i using this code in select ->createOptionForm([ TextInput::make('label') ->label('New category') ->required(), RichEditor::make('description') ]), and when this code is clicked it adds a + button next to the select column and opens a modal, and I also use searchable so I want when a record is searched and the record doesn't exist it displays the option to create a new record but without displaying the modal, so I can type the data directly in the select
2 Replies
krekas
krekas3w ago
You need a completely custom select field
RawaN
RawaN3w ago
maybe this work for you
->getSearchResultsUsing(function (string $search) {
$results = Item::where('item', 'like', "%{$search}%")
->limit(50)
->pluck('item', 'item')
->toArray();
$results[$search] = $search;
return $results;
})
->getSearchResultsUsing(function (string $search) {
$results = Item::where('item', 'like', "%{$search}%")
->limit(50)
->pluck('item', 'item')
->toArray();
$results[$search] = $search;
return $results;
})
Want results from more Discord servers?
Add your server