Вы должны иметь такую структуру:
Model::where('k', 5)->where(function($q){
$q->orWhere(function($q){
$q->where('i', 1)->where('j', 2);
})->orWhere(function($q){
$q->where('i', 3)->where('j', 4);
})->orWhere(function($q){
$q->where('i', 5)->where('j', 4);
});
})->toSql();
> select * from `table` where `k` = ? and ((`i` = ? and `j` = ?) or (`i` = ? and `j` = ?) or (`i` = ? and `j` = ?))
Таким образом, ваш запрос должен быть:
$getItems->where('k', 5)
->where(function ($query) use($codes, $cID) {
foreach($codes[$cID] as $code) {
$query->orWhere(function ($query1) use ($code, $cID) {
$query1->where('code', $code)->where('cid', $cID);
});
}
});