雄辩的Laravel嵌套在两者之间或之间

时间:2018-05-09 13:36:58

标签: laravel eloquent

您好我尝试以这种方式查询:

$result = DB:table('tableA')
          ->join('tableB','tableB.id','=','TableA.tid')
->join('tableC','tableB.sd','=','TableC.id')
 ->where('tableC.number', '=', '1')
 ->where('tableB.lang', '=', 'en')
->where(function ($q,$regFilterVal) {
                    // Nested OR condition
                    $q->whereBetween('tableC.numberMin',  $regFilterVal)
                        ->orBetween('tableC.numberMin',  $regFilterVal);
                })

我试着改变最后一部分:

->where(function ($q,$regFilterVal) {
                    // Nested OR condition
                    $q->whereBetween('tableC.numberMin',  $regFilterVal)
                        ->orBetween('tableC.numberMin',  $regFilterVal);
                })
by:
 ->whereBetween('tableC.numberMin',  $regFilterVal)
                        ->orBetween('tableC.numberMin',  $regFilterVal)

但是没有工作,我尝试做的是在sql:

and (TableC.numberMin between (a1,a2) or TableC.numberMax between (a1,a2))

然后在resumen我想添加一个where条件.... 和(condition1或condition2)其中2个条件介于两者之间,如此正确的sintax如何做到这一点

1 个答案:

答案 0 :(得分:1)

我认为问题在于回调

试试这个 -

$(".yourclass[data-id='yourid']")