这是以某种方式在核心中的whereIn的代码
public function whereIn($column, $values, $boolean = 'and', $not = false)
{
$type = $not ? 'NotIn' : 'In';
// ... irrelevant code omitted ...
$this->wheres[] = compact('type', 'column', 'values', 'boolean');
$this->addBinding($values, 'where');
return $this;
}
似乎不可能直接,但如果你能以某种方式覆盖它,它可能会有所帮助。
另一种方法是使用advance where
DB::table('users_clubs')
->Where(function($query)
{
foreach( $user_ids as $user_id ){
$query->where('user_id', '=', $user_id);
}
})
->Where(function($query)
{
foreach( $clubs as $club){
$query->where('club_id', '=', $club);
}
})
->get();
未对其进行测试,但似乎可能会进行一些修改。