Laravel多条件查询

$goodsShow = Goods::where('cate_id','=',$cate_id)
    ->where(function($query){
        $query->where('status','<','61')
            ->orWhere(function($query){
                $query->where('status', '91');
            });
    })->first();

这一段其实执行的就是where cate_id = $cate_id AND (status < 61 OR status = 91)

发表评论

电子邮件地址不会被公开。

This site uses Akismet to reduce spam. Learn how your comment data is processed.