I need to select multiple users in a form. So I picked a vue component called vue-multiselect. But I do not know how can I receive the selected user's ids in the $request array.
This is how I am using the component:
<multiselect
v-model="selected"
:options="users"
:multiple="true"
track-by="id"
@open="getUsers"
:custom-label="customLabel"
>
</multiselect>
I am binding the options to an array of objects called users and the selected user gets pushed to the selected prop.
The getUsers method performs an axios ajax call to fetch all the users to the users array.
I tried to insert a hidden input field in the form and v-modeled it to the selected prop:
<input type="hidden" name="users" v-model="selected">
But when the form was submitted and I dd'd the request array in my Laravel controller:
dd(request()->all());
request('users') contained the value: [object Object], which is definitely not what I expected.
How do I get the ID's of all the selected users?