Код: Выделить всё
$query = DB::table('table')->whereIn('some_field', [1,2,30])->toSql();
Model::join(DB::raw("({$query}) as table"), function($join) {
$join->on('model.id', '=', 'table.id');
})
Код: Выделить всё
Select * from model join (select * from table where some_field in (1,2,30)) as table on model.id = table.id
Код: Выделить всё
$query = DB::table('table')->whereRaw('some_field in ('. join(',', [1,2,30]) .')')->toSql();
Подробнее здесь: https://stackoverflow.com/questions/273 ... h-bindings