Thinkphp5 multi-field unique query

[
    [
        "goods_id" => 1,
        "attr_item" => "49,52"
    ], [
        "goods_id" => 1,
        "attr_item" => "49,51"
    ]
]

I would like to query such a condition goods_id=1 & & attr_item = = "49 attr_item 52 | | goods_id=1 & & attr_item = =" 49 attr_item 51 "
how to write the uniqueness of multi-field composition

Php
Apr.08,2022

query with closures

$result = Db::table('think_user')->where(function ($query) {
    $query->where('id', 1)->whereOr('id', 2);
})->whereOr(function ($query) {
    $query->where('name', 'like', 'think')->whereOr('name', 'like', 'thinkphp');
})->select();

generates a sql statement similar to the following

SELECT * FROM `think_user` WHERE  (  `id` = 1 OR `id` = 2 ) OR (  `name` LIKE 'think' OR `name` LIKE 'thinkphp' )
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1becc57-31b31.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1becc57-31b31.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?