I have price filter slider on my Laravel project and I am using Bootstrap slider.
Here is my input code on view
<input name="price" id="ex2" type="text" class="span2" value="" data-slider-min="10" data-slider-max="2000" data-slider-step="5" data-slider-value="[250,450]" onchange="checkBoxHandler()"/>
Here is my auto submit script on Javascript
<script>
function checkBoxHandler() {
$('#color_form').submit();
}
$("#ex2").slider({});
</script>
Here is my controller
$price = $request->price;
if (request()->has('price')) {
$products = product::whereBetween('price', [$price])
->whereHas('categories', function ($query) use ($tags){
$query->where('name', $tags);
})->paginate(20);
And I got the following error
SQLSTATE[HY093]: Invalid parameter number (SQL: select count(*) as aggregate from
products
whereprice
between 250,1400 and swim and exists (select * fromcategories
inner joincategory_product
oncategories
.id
=category_product
.category_id
whereproducts
.id
=category_product
.product_id
andname
= ?))