Database “Laravel数据库查询生成器”;其中不包括;去另一张桌子

Database “Laravel数据库查询生成器”;其中不包括;去另一张桌子,database,laravel,Database,Laravel,如何使用查询生成器在不使用DB::raw()的情况下将whereNotIn条件设置为其他表 $query=“从项目中选择* 其中prj_usr_id=$user->id 现在我解决了这个问题 $results = DB::table('project') ->where('prj_usr_id', '=' , 1 ) ->where('prj_status', '=' , 'open

如何使用查询生成器在不使用DB::raw()的情况下将whereNotIn条件设置为其他表

$query=“从项目中选择*
其中prj_usr_id=$user->id
现在我解决了这个问题

$results = DB::table('project')
                        ->where('prj_usr_id',  '=' , 1 ) 
                        ->where('prj_status',  '=' , 'open' ) 
                        ->where('prj_expiry',  '<' , Carbon::Now() ) 
                        ->whereNotIn ('prj_id',function ($query)
                        {
                            $query->select(DB::raw(1))
                                    ->from('bid')
                                    ->where('bd_status',  '=' , '1' ) 
                                    ->get(['bd_prj_id']); 
                        })
                        ->orderBy('prj_updated_date', 'desc') 
                        ->paginate(5);
return  $results; 
$results=DB::table('project'))
->其中('prj_usr_id','=',1)
->其中('prj_状态','=','open')

->其中(‘prj_到期’,‘可能与您的模型重复发布codes@herrjeh42谢谢,这很有帮助。
$results = DB::table('project')
                        ->where('prj_usr_id',  '=' , 1 ) 
                        ->where('prj_status',  '=' , 'open' ) 
                        ->where('prj_expiry',  '<' , Carbon::Now() ) 
                        ->whereNotIn ('prj_id',function ($query)
                        {
                            $query->select(DB::raw(1))
                                    ->from('bid')
                                    ->where('bd_status',  '=' , '1' ) 
                                    ->get(['bd_prj_id']); 
                        })
                        ->orderBy('prj_updated_date', 'desc') 
                        ->paginate(5);
return  $results;