Laravel价格过滤中间

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 where price between 250,1400 and swim and exists (select * from categories inner join category_product on categories.id = category_product.category_id where products.id = category_product.product_id and name = ?))

For whereBetween, you need to pass array.

whereBetween('price', explode(',', $price))