I am trying to make Laravel Search and stuck at point of handling POST data as an array in Eloquent way
HTML Form is as
<form>
<select name="hidArray[]">
<option name="test">Test</option>
<option name="test2">Test2</option>
</select>
</form>
Now, this input has been initialized as Bootstrap Multiselect
When i get input as POST request then it has been represented as an array like as below and which is expetced
array:2 [▼
0 => "test"
1 => "test2"
]
Now, i want to form Eloquent query to get results from database.
I tried like as below:
if($request->has('hidArray')){
$profile->whereIn('hidArray', $request->input('hidArray'));
}
But i think, this way it is not working. Is there any other way i can perform this operation?
I don't have exact idea what are you upto but according to what I understood.
You are trying to do something like: