You miss equals sign here.
->join('product_categories','product_categories.id', '=', 'products.categories_id')
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Error Log
[2020-10-30 18:56:53] local.ERROR: Illegal operator and value combination. {"userId":5,"exception":"[object] (InvalidArgumentException(code: 0): Illegal operator and value combination. at /Applications/XAMPP/xamppfiles/htdocs/afiaprime/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php:754)
[stacktrace]
Controller
public function productsCat(Request $request){
$cat_id = $request->cat_id;
// dd(count($request->price));
$pricemax= $request->max_price;
$pricemin= $request->min_price;
$search= $request->search;
// price are array
if($cat_id!="" && $pricemax!="0" && $search!=""){
// $price = explode("-",$request->price);
$pricemax= $request->max_price;
$pricemin= $request->min_price;
$search= $request->search;
$start = $pricemin;
$end = $pricemax;
//echo "both are selected";
$data = DB::table('products')
->join('product_categories','product_categories.id','products.categories_id')
->where('products.categories_id',$cat_id)
->where('products.price', ">=", $start)
->where('products.price', "<=", $end)
->where('products.p_name',$search)
->get();
}
else if($pricemax!="0"){
// $price = explode("-",$request->price);
$pricemax= $request->max_price;
$pricemin= $request->min_price;
$start = $pricemin;
$end = $pricemax;
//echo "price is selected";
$data = DB::table('products')
->join('product_categories','product_categories.id','products.categories_id')
->where('products.price', ">=", $start)
->where('products.price', "<=", $end)
->get();
}
else if($cat_id!=""){
//echo "cat is selected";
$data = DB::table('products')
->join('product_categories','product_categories.id','products.categories_id')
->where('products.categories_id',$cat_id)
->get();
}
else{
//echo "nothing is slected";
return "<h1 align='center'>Please select atleast one filter from dropdown</h1>";
}
if(!$data){
echo "<h1 align='center'>no products found under this Category</h1>";
}else{
return view('frontEnd.produt-category',[
'data' => $data, 'catByUser' => $data[0]->cat_name
]);
}
}
Please or to participate in this conversation.