I want to make filter. In view i have two inputs like this:
<input type="checkbox" id="test" value="" name="prop_category[]"/>
<input type="checkbox" id="toggle-on" value="" class="singleChb" name="publishing_types" @if ($index == 1) {!! "checked" !!}
First input can have multiple values and second can have only only one value.
Now in controller i have this:
foreach($options as $key => $option) {
if($key != "search" &&
$key != "page" &&
$key != "starterResult" &&
$key != "totalResult") {
$query->whereHas($key,function($q) use($option){
$q->orWhere('name', 'like', $option);
});
}
}
In $options
i get an array for first input and for second i get one value. How can i use that now orWhere
to check all of that selected values from first input. Now im able to check only for one value, and not for array. Any suggetion?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire