How to multi-select a BelongsToMany value? I have tried multiple approaches, but must be missing something. Any terse example of the fields and model changes needed to enable this appreciated.
In the example I have a Note and Tags, where the Tas have a BelongsToMany relation.
I wasn't able to store the selected Tag id's in the separate note_tag table therefore added an extra column in the Note model where the id's are stored of the selected tags.
So I get all tags:
public function fields(Request $request)
{
$tags = \App\Tag::all()->pluck('name', 'id');
Then
Multiselect::make('Tags', 'tags')
->options($tags)
->placeholder('Kies een of meerdere tags'),
That worked for me nevertheless I can't add the tags column to the search as it stores the id's. And using a filter with dynamic values is not working as well.