◆A and (B or C) の条件の作り方
1 2 3 4 |
$datas = \User::where('created_at' ,'<>',null) ->where(function($query){ $query->where('created_at','<',’2019-01-01’)->orWhere('update_at', '=', null); })->get(); |
パラメータを渡したい時の例は以下
1 2 3 4 5 |
$date = date('Y-m-d H:i:s',strtotime('-1 day')); $datas = \User::where('created_at' ,'<>',null) ->where(function($query) use ($date){ $query->where('created_at','<',$date)->orWhere('update_at', '=', null); })->get(); |
&nb […]