I have been working with a laravel 5.3 version and in a table i have a json column where i have saved average rating of a category table. so, A product category table has a column "detail" as a json data type which saves avgRating. I want to run a query inside that json column. And i want to filter that category with a average rating. So, from the frontend side rating comes in a parameter with a comma seperated so that category can be filtered with multiple ratings.
$productCategory = ProductCategory::query();
$ratings = explode(',',$params['ratings']);
$productCategory = $productCategory->whereIn('detail->avgRating',$ratings)->get();
I want to achieve something like this. I am using Postgres