laravel where orwhere的写法

  1. $goodsShow = Goods::where('cate_id','=',$cate_id)

  2. ->where(function($query){

  3. $query->where('status','<','61')

  4. ->orWhere(function($query){

  5. $query->where('status', '91');

  6. });

  7. })->first();

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

你可能感兴趣的:(Laravel,Laravel)