TagsInput : Suggestions list
Hi, is there a way to reset the suggestions list of TagsInput field ?
i've a case when changing a select field i should change the the suggestions list
here's my code :
i've a case when changing a select field i should change the the suggestions list
here's my code :
Select::make('model')
->options(['model1' => 'model1', 'model2' => 'model2'])
->afterStateUpdated(fn ($set) => $set('ids', []))
->reactive()
->required(),
Forms\Components\TagsInput::make('ids')
->suggestions(
function ($state, $get) {
if ($get('model')) {
return app()->make("App\Models\\" . $get('model'))::pluck('name', 'id');
} else
return $state;
}
)
->required(),