I made a filter to find businesses
There are several cities to choose from
Cities store on city_id column
The filter looks like this
<select id="city" multiple name="city[]">
@foreach($cities as $city)
<option value="{{ $city->name }}">{{ $city->name }}</option>
@endforeach
</select>
All request
dd($request->all())
shows me this
I build query for franchise or business like this
if ($request->has('fb')) {
$businessesQuery->where('fb', $request->fb);
}
I try to build query like this but it's not works
if ($request->has('city[]')) {
$typeArray = explode(",", $request->city[]);
$businessesQuery->whereIn('city_id', $typeArray);
}
Help me solve this issue, I would be very grateful!


->whereIn('city_id', $request->city)since whereIn() accepts arrays