Skip to content

Commit

Permalink
Handle collections
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanmitchell committed Feb 8, 2024
1 parent cfc37c1 commit 92817d1
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/Modifiers/CoreModifiers.php
Original file line number Diff line number Diff line change
Expand Up @@ -922,10 +922,18 @@ public function includes($haystack, $params, $context)
{
$needle = $this->getFromContext($context, $params);

if ($needle instanceof Collection) {
$needle = $needle->values()->all();
}

if (! is_array($needle)) {
$needle = [$needle];
}

if ($haystack instanceof Collection) {
$haystack = $haystack->values()->all();
}

if (! is_array($haystack)) {
return false;
}
Expand Down

0 comments on commit 92817d1

Please sign in to comment.