I have some search with multiple arguments and I want to query if the input is not null then make query argument.
I tried many ways but I cannot get query results.
Here is my sample code
$products = Product::where('game_id',$tg->id);
if($keyword !=null){
$products->where("name","like",$keyword);
}
if($price_start !=null){
$products->where("price",">",$price_start);
}
if($price_end !=null){
$products->where("price","<",$price_end);
}
if($avalibility !=null){
$products->where("status","=",$avalibility);
}
$products->orderBy("created_at","DESC");
$products->get();
$products->get()->get();after all queries