Php tp5 complex sql Construction problem

there is a sql statement that you want to construct with the constructor of tp5, as follows

Select * from tab1 where (axi1 and baked 1) or (a2 and baked 2) or (axi3 and baked 3) .or (aural N and baked N)

Note: when N is equal to, there are as many or connections as there are, and the number of or is a variable. How to find out the results with the chain query of Tp5? Has been bothering me all day, asking for an answer from God!

look up an example on the Internet $res = Db::table ("fd_user")-> where (" sex","eq"," male")
-> where (function ($query) {
$query- > where ("name","like"," Lee%")
-> whereOr ("age","eq",18);
})
-> buildSql ();

this is OK, but he has only one whereOr. My requirement is that whereOr is not fixed. There may be one or two. How to break


    $sqlQuery = DB::table('tab1')->where(['a' => 1, 'b' => 1]);
    $n = 10;
    for ($i = 2; $i <= $n; $iPP) {
        $sqlQuery = $sqlQuery->orWhere(function ($query) use ($i) {
            $query->where(['a' => $i, 'b' => $i]);
        });
    }
    return $sqlQuery->toSql();
Menu