Skip to content

Commit

Permalink
Fixed issue w/merge() not modifying arr in place
Browse files Browse the repository at this point in the history
Fixed issue w/merge() not modifying arr in place & instead returning
  • Loading branch information
ericdrosas87 committed Feb 28, 2024
1 parent af21957 commit 84f963e
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions src/lib/laravel/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,10 @@ public function whereContainsIn($keys, $value): Collection
});

if($recs->count() > 0) {
if($matched_records == []) {
$count = $recs->count();
$type_rec = gettype($recs);
if ($matched_records == []) {
$matched_records = $recs;
} else {
$count = $recs->count();
$matched_records->merge($recs);
$count2 = $matched_records->count();
$matched_records = $matched_records->concat($recs);
}
}

Expand All @@ -59,10 +55,9 @@ public function whereContainsIn($keys, $value): Collection
if($matched_records == []) {
// To-do: Come up with a more elegant solution, rather than calling only()
return $this->only([""]);
} else {
return $matched_records->unique();
}


return $matched_records->unique("id");
}

/**
Expand Down

0 comments on commit 84f963e

Please sign in to comment.