laravel 的搜索中的括号应该怎么加
有需要搜索status为1或2且 action为1的记录,原生的sql是where (status_id=1 or status_id=2) and action_id = 1,但是用
orWhere的话是这样的 Where(‘status_id’,1)->orWhere(‘status_id’,2)->where(‘action_id’,1),这样搜索的结果实际是
where status_id = 1 or status_id=2 and action_id = 1,和需要的不符,问下这个括号在组合中怎么处理?
where
部分这样写试一下。