I have this query:
$products = Product::whereIn('brand_id', $brand)->get();
which is returning result of selected brands. But if I want to add another fields such as min and max price it returns error, here is my code:
$brand = Input::has('brands') ? Input::get('brands') : [];
$min_price = Input::has('min_price') ? Input::get('min_price') : null;
$max_price = Input::has('max_price') ? Input::get('max_price') : null;
$products = Product::orWhere('price','>=',$min_price)
->orWhere('price','<=',$max_price)
->orWhereHas('brands',function($query){
$query->whereIn('brand_id', $brand);
})->get();
error i get:
Illegal operator and value combination.