There is a table:
filters_to_products Структура: id category_id product_id filter_id There is a form
<form method="get"> <input type="checkbox" value="1" name="array[]"> <input type="checkbox" value="2" name="array[]"> <input type="checkbox" value="3" name="array[]"> <input type="checkbox" value="4" name="array[]"> <button>Filter</button> </form> PS Inputs dynamic.
There is a controller:
foreach($request->input('array') as $row) { $ids = $row; } $items = Item::where('category_id', '1')->whereIn('id', $ids)->get()->all(); The trouble is that the filter should filter out the values, for example, if I selected the чекбокс с value 1 и чекбокс с value 2 then I should get only those items that are in the table by coincidence, but it turns out that I have a selection on which have such an id, that is, roughly speaking, positions are not filtered, but are summarized on the basis of filters.