0

the attribute column stores json

{
 "size":  [432, 433, 434], 
 "color": [17, 23, 56], 
 "brand": [36], 
 "type":  [12,13,14,15]
}

help me make a query in laravel to search for records that have, for example: color = [17, 23]

1 Answers1

0

where you gonna implement that search option ? in dropdown? if you use it in blade dropdown go through this link https://www.webslesson.info/2017/02/live-search-json-data-using-ajax-jquery.html#:~:text=After%20loading%20JSON%20File%20data%20we%20want%20search,format%20and%20here%20we%20can%20search%20by%20

and if you going to search in controller/model use the steps mention below

first, use json_decode and convert it into an array then use another variable to store what you goona filter then use below example to filter filtering json data in php laravel