Laravel 5 using OR condition with BETWEEN

后端 未结 5 945
死守一世寂寞
死守一世寂寞 2020-12-16 05:37

Hi can anyone help me building below query in laravel Eloquent i am really confuse in using OR condition with between

SELEC         


        
5条回答
  •  北海茫月
    2020-12-16 06:21

    You have to group the parameters, adapt the example in the documentation

    DB::table('users')
                ->where('name', '=', 'John')
                ->where(function ($query) {
                    $query->where('votes', '>', 100)
                          ->orWhere('title', '=', 'Admin');
                })
                ->get();
    

提交回复
热议问题