Laravel,如何搜索产品特性?获取数组中每个项目都存在于 table 中的 ID

Laravel, how to search for product features? get the ids where every item in array is present in table

我有一个 table 具有产品功能 table 结构低于
..|product_id | feature_id|created_at
..|1 | 5 |time_stamp
..|1 | 6 |time_stamp

..|2 | 6 |time_stamp

..|2 | 9 |time_stamp
.
.
.

如何编写查询以使用数组 [5,6] 进行搜索并获得产品 ID 1 的结果

你可以试试

product_feature_data是型号名称

Proudct::whereHas('product_feature_data',function($q) {
  $q->whereIn('feature_id', [5,6]);
})->get();