Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/62.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 使用后端嵌套的json数据搜索和筛选输入值_Php_Mysql_Json_Laravel - Fatal编程技术网

Php 使用后端嵌套的json数据搜索和筛选输入值

Php 使用后端嵌套的json数据搜索和筛选输入值,php,mysql,json,laravel,Php,Mysql,Json,Laravel,我在拉威尔电子商务REST API的和API是过滤器的工作。无论用户将筛选什么,都应在后端元键列(包含深嵌套json)中搜索,并应返回匹配的记录 我尝试了以下方法:- Parameter receiving from mobile side:- **(below params can be either or)** 1.$brand = $request->brand; 2.$size = $request->brand; 3.$color = $request->brand

我在拉威尔电子商务REST API的和API是过滤器的工作。无论用户将筛选什么,都应在后端元键(包含深嵌套json)中搜索,并应返回匹配的记录

我尝试了以下方法:-

Parameter receiving from mobile side:- 
**(below params can be either or)**
1.$brand = $request->brand;
2.$size = $request->brand;
3.$color = $request->brand;
4.$rating = $request->brand;

$sql = ProductsMeta::where('meta_value','LIKE','%'.$brand.'%')
         ->orWhere('meta_value','LIKE','%'.$color.'%')
         ->orWhere('meta_value','LIKE','%'.$size.'%')
         ->orWhere('meta_value','LIKE','%'.$rating.'%');
除此之外,这不会返回记录

我还尝试使用FIND_IN_SET()方法。但是,这也不适合我


您能建议我获得此解决方案吗?

哪种类型的元数据为DB?字符串还是json对象?那么什么是
$request->brand
,为什么是
1。2.3.4.
??这真的存在于代码中吗?看看这个@V-K的长文本数据类型和jsonobject@RiggsFolly,1.2.3.4只是参数的系列。不要考虑这个系列。